-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from mycelium-com/modulesSettingsFix
#872 Implemented logic to support contract versions in settings.
- Loading branch information
Showing
20 changed files
with
338 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
mbw/src/main/java/com/mycelium/wallet/activity/view/TwoButtonsPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.mycelium.wallet.activity.view; | ||
|
||
|
||
import android.content.Context; | ||
import android.preference.Preference; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import com.mycelium.wallet.R; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
|
||
public class TwoButtonsPreference extends Preference { | ||
@BindView(R.id.top_button) | ||
Button topButton; | ||
|
||
@BindView(R.id.bottom_button) | ||
Button bottomButton; | ||
|
||
private View.OnClickListener topButtonClickListener; | ||
private View.OnClickListener bottomButtonClickListener; | ||
private String topButtonText; | ||
private String bottomButtonText; | ||
private boolean topButtonEnabled; | ||
private boolean bottomButtonEnabled; | ||
|
||
public TwoButtonsPreference(Context context) { | ||
super(context); | ||
setWidgetLayoutResource(R.layout.two_button_preference); | ||
} | ||
|
||
@Override | ||
protected void onBindView(final View view) { | ||
super.onBindView(view); | ||
ButterKnife.bind(this, view); | ||
topButton.setText(topButtonText); | ||
bottomButton.setText(bottomButtonText); | ||
topButton.setEnabled(topButtonEnabled); | ||
bottomButton.setEnabled(bottomButtonEnabled); | ||
topButton.setOnClickListener(topButtonClickListener); | ||
bottomButton.setOnClickListener(bottomButtonClickListener); | ||
} | ||
|
||
public void setTopButtonClickListener(View.OnClickListener buttonClickListener) { | ||
topButtonClickListener = buttonClickListener; | ||
} | ||
|
||
public void setBottomButtonClickListener(View.OnClickListener buttonClickListener) { | ||
bottomButtonClickListener = buttonClickListener; | ||
} | ||
|
||
public void setEnabled(boolean preferenceEnabled, boolean topButtonEnabled, boolean bottomButtonEnabled) { | ||
this.topButtonEnabled = topButtonEnabled; | ||
this.bottomButtonEnabled = bottomButtonEnabled; | ||
this.setEnabled(preferenceEnabled); | ||
if (topButton != null) { | ||
topButton.setEnabled(topButtonEnabled); | ||
} | ||
if (bottomButton != null) { | ||
bottomButton.setEnabled(bottomButtonEnabled); | ||
} | ||
} | ||
|
||
public void setButtonsText(String topButtonText, String bottomButtonText) { | ||
this.bottomButtonText = bottomButtonText; | ||
this.topButtonText = topButtonText; | ||
|
||
if (bottomButton != null) { | ||
bottomButton.setText(bottomButtonText); | ||
} | ||
|
||
if (topButton != null) { | ||
topButton.setText(topButtonText); | ||
} | ||
} | ||
} |
Oops, something went wrong.