Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdec8926 authored by Joseph Lehner's avatar Joseph Lehner
Browse files

Update "one" key's voicemail status if it changed

When launching the Phone app, it checks whether a voicemail
number is available and sets the background image of the "one"
key accordingly.
If a voicemail number was set *after* the app was launched,
the button was never updated (unless the app was force-closed
manually).

Change-Id: I6ef18cbb1a72609ebdd3380d2ebd76a986b8295b
parent c8dd76e1
Loading
Loading
Loading
Loading
+31 −19
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
    private SharedPreferences ePrefs;
    private boolean prefVibrateOn, retrieveLastDialled, returnToDialer;
    
    // stores the return value of the last call to hasVoicemail()
    private boolean mHasVoicemail;

    private static final int MENU_SMS = 4;
    private static final int MENU_PREFERENCES = 5;

@@ -241,7 +244,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        // Check for the presence of the keypad
        View view = findViewById(R.id.one);
        if (view != null) {
            setupKeypad();
            setupKeypad(true);
        }

        mVoicemailDialAndDeleteRow = findViewById(R.id.voicemailAndDialAndDelete);
@@ -406,7 +409,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        mDigits.addTextChangedListener(this);
    }

    private void setupKeypad() {
    private void setupKeypad(boolean setupAllDigits) {
        // Setup the listeners for the buttons
        
        //YC: Changed type from View to ImageButton
@@ -414,14 +417,17 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        digitOne.setOnClickListener(this);
        digitOne.setOnLongClickListener(this);

        mHasVoicemail = hasVoicemail();

        //YC: Set image accordingly        
        if (hasVoicemail()) {
        if (mHasVoicemail) {
        	digitOne.setImageResource(R.drawable.dial_num_1_with_vm);
        }
        else {
        	digitOne.setImageResource(R.drawable.dial_num_1_no_vm);
        }

        if (setupAllDigits) {
            findViewById(R.id.two).setOnClickListener(this);
            findViewById(R.id.three).setOnClickListener(this);
            findViewById(R.id.four).setOnClickListener(this);
@@ -438,6 +444,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,

            findViewById(R.id.pound).setOnClickListener(this);
        }
    }

    @Override
    protected void onResume() {
@@ -1434,6 +1441,11 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
    	initVoicemailButton();
    	checkForNumber();
    	setDigitsColor();

        // The voicemail number might have been set after the app was started
        if (mHasVoicemail != hasVoicemail()) {
            setupKeypad(false);
        }
    }    
    
    //Wysie: Method to check if there's any number entered