mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Fix the upper refresh button in MessageList
This commit is contained in:
parent
1b9abb2b9b
commit
6c27d3e7ef
@ -1,30 +1,14 @@
|
||||
<!--
|
||||
Copyright 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingLeft="12dp">
|
||||
<!-- FrameLayout ignores margins on android 2.x so we use this padding
|
||||
to make sure the total is the same width as the icon we
|
||||
replace and no visual shifting occurs -->
|
||||
android:paddingLeft="12dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ProgressBar android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_alignParentRight="true"
|
||||
style="?android:attr/indeterminateProgressStyle" />
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -6,7 +6,7 @@
|
||||
android:focusable="true" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton1"
|
||||
android:id="@+id/actionbar_refresh_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
|
@ -313,7 +313,9 @@ public class MessageList
|
||||
|
||||
private MenuItem mRefreshMenuItem;
|
||||
private View mActionBarProgressView;
|
||||
private View mCustomRefreshView;
|
||||
private ActionBarNavigationSpinner mNavigationSpinner;
|
||||
private ActionBar mActionBar;
|
||||
private Bundle mState = null;
|
||||
|
||||
/**
|
||||
@ -558,9 +560,9 @@ public class MessageList
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
mRefreshMenuItem.setActionView(mActionBarProgressView);
|
||||
mActionBar.setCustomView(mActionBarProgressView);
|
||||
} else {
|
||||
mRefreshMenuItem.setActionView(null);
|
||||
mActionBar.setCustomView(mCustomRefreshView);
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,14 +903,26 @@ public class MessageList
|
||||
private void initializeActionBar() {
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setCustomView(R.layout.actionbar_top_custom);
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
|
||||
mActionBar = getSupportActionBar();
|
||||
|
||||
mCustomRefreshView = mInflater.inflate(R.layout.actionbar_top_custom, null);
|
||||
ImageButton mCustomRefresh = (ImageButton) mCustomRefreshView.findViewById(R.id.actionbar_refresh_button);
|
||||
mCustomRefresh.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mFolderName != null) {
|
||||
checkMail(mAccount, mFolderName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mActionBar.setCustomView(mCustomRefreshView);
|
||||
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
|
||||
ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
mActionBar.setDisplayShowTitleEnabled(false);
|
||||
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
mNavigationSpinner = ActionBarNavigationSpinner.getDefaultSpinner(this);
|
||||
actionBar.setListNavigationCallbacks(mNavigationSpinner, this);
|
||||
mActionBar.setListNavigationCallbacks(mNavigationSpinner, this);
|
||||
}
|
||||
|
||||
private void initializeLayout() {
|
||||
@ -1568,12 +1582,6 @@ public class MessageList
|
||||
}
|
||||
|
||||
switch (itemId) {
|
||||
case R.id.check_mail: {
|
||||
if (mFolderName != null) {
|
||||
checkMail(mAccount, mFolderName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case R.id.send_messages: {
|
||||
mController.sendPendingMessages(mAccount, mAdapter.mListener);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user