Commit d6c9cb26 authored by Hussein's avatar Hussein

Merge branch 'P4A-980' into release/v1.1.200

parents 5d6612e2 1e882496
......@@ -21,7 +21,6 @@ import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.CheckBox;
import android.widget.ProgressBar;
import android.widget.TextView;
......@@ -83,11 +82,6 @@ import com.fsck.k9.view.MessageTitleView;
import com.fsck.k9.view.ViewSwitcher;
import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener;
import com.google.android.material.navigation.NavigationView;
import com.karumi.dexter.PermissionToken;
import com.karumi.dexter.listener.PermissionDeniedResponse;
import com.karumi.dexter.listener.PermissionGrantedResponse;
import com.karumi.dexter.listener.PermissionRequest;
import com.karumi.dexter.listener.single.PermissionListener;
import com.pedrogomez.renderers.ListAdapteeCollection;
import com.pedrogomez.renderers.RVRendererAdapter;
import com.pedrogomez.renderers.RendererBuilder;
......@@ -341,7 +335,7 @@ public class MessageList extends PepActivity implements MessageListFragmentListe
private ProgressBar mActionBarProgress;
private MenuItem mMenuButtonCheckMail;
private CheckBox flaggedCheckbox;
private MenuItem flaggedCheckbox;
private View mActionButtonIndeterminateProgress;
private int mLastDirection = (K9.messageViewShowNext()) ? NEXT : PREVIOUS;
......@@ -1906,6 +1900,9 @@ public class MessageList extends PepActivity implements MessageListFragmentListe
case R.id.privacyStatus:
mMessageViewFragment.onPEpPrivacyStatus(true);
return true;
case R.id.flag:
mMessageViewFragment.onToggleFlagged();
return true;
}
if (!mSingleFolderMode) {
......@@ -1930,16 +1927,21 @@ public class MessageList extends PepActivity implements MessageListFragmentListe
getMenuInflater().inflate(R.menu.message_list_option, menu);
mMenu = menu;
mMenuButtonCheckMail = menu.findItem(R.id.check_mail);
flaggedCheckbox = (CheckBox) menu.findItem(R.id.flag).getActionView();
flaggedCheckbox.setButtonDrawable(resourcesProvider.getAttributeResource(R.attr.iconFlagButtonOpaque));
flaggedCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (buttonView.isPressed())
mMessageViewFragment.onToggleFlagged();
}
);
flaggedCheckbox = menu.findItem(R.id.flag);
return true;
}
private void checkFlagMenuItemChecked(boolean check) {
if(check) {
flaggedCheckbox.setIcon(resourcesProvider.getAttributeResource(R.attr.flagOpaqueCheckedIcon));
flaggedCheckbox.setTitle(R.string.unflag_action);
}
else {
flaggedCheckbox.setIcon(resourcesProvider.getAttributeResource(R.attr.flagOpaqueUncheckedIcon));
flaggedCheckbox.setTitle(R.string.flag_action);
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
......@@ -2010,8 +2012,7 @@ public class MessageList extends PepActivity implements MessageListFragmentListe
next.getIcon().setAlpha(canDoNext ? 255 : 127);
}
flaggedCheckbox.setChecked(mMessageViewFragment.isMessageFlagged());
checkFlagMenuItemChecked(mMessageViewFragment.isMessageFlagged());
// Set title of menu item to toggle the read state of the currently displayed message
if (mMessageViewFragment.isMessageRead()) {
......
......@@ -14,9 +14,8 @@
<!-- MessageView -->
<item
android:id="@+id/flag"
android:icon="?attr/iconFlagButtonOpaque"
android:icon="?attr/flagOpaqueUncheckedIcon"
android:title="@string/flag_action"
app:actionViewClass="android.widget.CheckBox"
android:checkable="true"
app:showAsAction="always" />
......
......@@ -77,7 +77,8 @@
<attr name="iconAdavancedSettings" format="reference"/>
<attr name="iconFlagButton" format="reference"/>
<attr name="iconFlagButtonGreen" format="reference"/>
<attr name="iconFlagButtonOpaque" format="reference"/>
<attr name="flagOpaqueCheckedIcon" format="reference"/>
<attr name="flagOpaqueUncheckedIcon" format="reference"/>
<attr name="openpgp_black" format="reference|color" />
<attr name="openpgp_orange" format="reference|color" />
......
......@@ -100,7 +100,8 @@
<item name="iconAdavancedSettings">@drawable/ic_advanced_light</item>
<item name="iconFlagButton">@drawable/ic_flag_button_light</item>
<item name="iconFlagButtonGreen">@drawable/ic_flag_button_green</item>
<item name="iconFlagButtonOpaque">@drawable/ic_flag_button_opaque_light</item>
<item name="flagOpaqueCheckedIcon">@drawable/ic_flag_opaque_light</item>
<item name="flagOpaqueUncheckedIcon">@drawable/ic_flag_border_opaque_light</item>
<item name="iconPepLogo">@drawable/ic_pep_logo_light</item>
</style>
......@@ -203,7 +204,8 @@
<item name="iconFlagButton">@drawable/ic_flag_button_dark</item>
<item name="iconFlagButtonGreen">@drawable/ic_flag_button_green</item>
<item name="iconFlagButtonOpaque">@drawable/ic_flag_button_dark</item>
<item name="flagOpaqueCheckedIcon">@drawable/ic_flag_dark</item>
<item name="flagOpaqueUncheckedIcon">@drawable/ic_flag_border_dark</item>
<item name="iconPepLogo">@drawable/ic_pep_logo_dark</item>
</style>
......@@ -335,7 +337,8 @@
<item name="iconFlagButton">@drawable/ic_flag_button_light</item>
<item name="iconFlagButtonGreen">@drawable/ic_flag_button_green</item>
<item name="iconFlagButtonOpaque">@drawable/ic_flag_button_opaque_light</item>
<item name="flagOpaqueCheckedIcon">@drawable/ic_flag_opaque_light</item>
<item name="flagOpaqueUncheckedIcon">@drawable/ic_flag_border_opaque_light</item>
<item name="iconPepLogo">@drawable/ic_pep_logo_light</item>
</style>
......@@ -425,7 +428,8 @@
<item name="iconAdavancedSettings">@drawable/ic_advanced_dark</item>
<item name="iconFlagButton">@drawable/ic_flag_button_dark</item>
<item name="iconFlagButtonGreen">@drawable/ic_flag_button_green</item>
<item name="iconFlagButtonOpaque">@drawable/ic_flag_button_dark</item>
<item name="flagOpaqueCheckedIcon">@drawable/ic_flag_dark</item>
<item name="flagOpaqueUncheckedIcon">@drawable/ic_flag_border_dark</item>
<item name="iconPepLogo">@drawable/ic_pep_logo_dark</item>
</style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment