Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Add localizations notes to the application strings. Fixes #625 #624 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Oct 18, 2018
1 parent ec364b0 commit 60c159d
Show file tree
Hide file tree
Showing 19 changed files with 299 additions and 304 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {
}
}
}

if (gradle.hasProperty('taskclusterBuild')) {
project.archivesBaseName = "FirefoxReality-$defaultConfig.versionName-$generatedVersionCode"
defaultConfig.versionCode = generatedVersionCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void initialize(Context aContext) {
mAudio = AudioEngine.fromContext(aContext);

TextView description = findViewById(R.id.setting_description);
description.setText(mButtonText);
description.setText(mDescription);

mButton = findViewById(R.id.button);
mButton.setText(mButtonText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class SettingsButton extends LinearLayout {
private TextView mText;
private TextView mSecondaryText;
private String mButtonText;
private float mButtonTextSize;
private String mSecondaryButtonText;
private Drawable mButtonIcon;

Expand All @@ -31,6 +32,7 @@ public SettingsButton(Context context, @Nullable AttributeSet attrs, int defStyl
super(context, attrs, defStyleAttr);
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.SettingsButton, defStyleAttr, 0);
mButtonText = attributes.getString(R.styleable.SettingsButton_settingsButtonText);
mButtonTextSize = attributes.getDimension(R.styleable.SettingsButton_settingsButtonTextSize, 0.0f);
mButtonIcon = attributes.getDrawable(R.styleable.SettingsButton_settingsButtonIcon);
mSecondaryButtonText = attributes.getString(R.styleable.SettingsButton_settingsSecondaryText);
initialize(context);
Expand All @@ -46,8 +48,12 @@ private void initialize(Context aContext) {
mIcon.setImageDrawable(mButtonIcon);

mText = findViewById(R.id.settings_button_text);
if (mText != null)
if (mText != null) {
mText.setText(mButtonText);
if (mButtonTextSize > 0) {
mText.getLayoutParams().width = (int) mButtonTextSize;
}
}

mSecondaryText = findViewById(R.id.settings_secondary_text);
if (mSecondaryText != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.audio.AudioEngine;

public class CrashDialogWidget extends UIWidget implements WidgetManagerDelegate.FocusChangeListener {

private static final String LOGTAG = "VRB";

public interface CrashDialogDelegate {
void onSendData();
}

private Button mLearnMoreButton;
private Button mDontSendButton;
private Button mDoNotSendButton;
private Button mSendDataButton;
private CheckBox mSendDataCheckBox;
private AudioEngine mAudio;
private CrashDialogDelegate mCrashDialogDelegate;
private TextView mCrashMessage;

public CrashDialogWidget(Context aContext) {
super(aContext);
Expand All @@ -52,65 +55,58 @@ private void initialize(Context aContext) {
mWidgetManager.addFocusChangeListener(this);

mLearnMoreButton = findViewById(R.id.learnMoreButton);
mDontSendButton = findViewById(R.id.dontSendButton);
mDoNotSendButton = findViewById(R.id.dontSendButton);
mSendDataButton = findViewById(R.id.sendDataButton);
mSendDataCheckBox = findViewById(R.id.crashSendDataCheckbox);
mCrashMessage = findViewById(R.id.crashMessage);

mLearnMoreButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
mLearnMoreButton.setOnClickListener(view -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

GeckoSession session = SessionStore.get().getCurrentSession();
if (session == null) {
int sessionId = SessionStore.get().createSession();
SessionStore.get().setCurrentSession(sessionId);
}
GeckoSession session = SessionStore.get().getCurrentSession();
if (session == null) {
int sessionId = SessionStore.get().createSession();
SessionStore.get().setCurrentSession(sessionId);
}

SessionStore.get().loadUri(getContext().getString(R.string.crash_dialog_learn_more_url));
SessionStore.get().loadUri(getContext().getString(R.string.crash_dialog_learn_more_url));

onDismiss();
}
onDismiss();
});
mDontSendButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

onDismiss();

mDoNotSendButton.setOnClickListener(view -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

onDismiss();
});
mSendDataButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

hide();
mSendDataButton.setOnClickListener(view -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

if(mCrashDialogDelegate != null) {
mCrashDialogDelegate.onSendData();
}
hide();

SettingsStore.getInstance(getContext()).setCrashReportingEnabled(mSendDataCheckBox.isChecked());
if(mCrashDialogDelegate != null) {
mCrashDialogDelegate.onSendData();
}

SettingsStore.getInstance(getContext()).setCrashReportingEnabled(mSendDataCheckBox.isChecked());
});

mSendDataCheckBox = findViewById(R.id.crashSendDataCheckbox);
mSendDataCheckBox.setChecked(SettingsStore.getInstance(getContext()).isCrashReportingEnabled());
mSendDataCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
mSendDataCheckBox.setOnCheckedChangeListener((compoundButton, b) -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}
});

mCrashMessage.setText(getContext().getString(R.string.crash_dialog_message, getContext().getString(R.string.app_name)));

mAudio = AudioEngine.fromContext(aContext);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class DeveloperOptionsWidget extends UIWidget {
private RadioGroupSetting mPointerColorRadio;
private RadioGroupSetting mUaModeRadio;
private RadioGroupSetting mMSAARadio;
private RadioGroupSetting mEventsRadio;

private SingleEditSetting mDensityEdit;
private SingleEditSetting mDpiEdit;
Expand Down Expand Up @@ -128,11 +127,6 @@ public void onClick(View view) {
mMSAARadio.setOnCheckedChangeListener(mMSSAChangeListener);
setMSAAMode(mMSAARadio.getIdForValue(msaaLevel), false);

int inputMode = SettingsStore.getInstance(getContext()).getInputMode();
mEventsRadio = findViewById(R.id.events_radio);
mEventsRadio.setOnCheckedChangeListener(mMSSAChangeListener);
setInputMode(mEventsRadio.getIdForValue(inputMode), false);

mDensityEdit = findViewById(R.id.density_edit);
mDensityEdit.setFirstText(Float.toString(SettingsStore.getInstance(getContext()).getDisplayDensity()));
mDensityEdit.setOnClickListener(mDensityListener);
Expand Down Expand Up @@ -251,13 +245,6 @@ public void onCheckedChanged(RadioGroup radioGroup, int checkedId, boolean doApp
}
};

private RadioGroupSetting.OnCheckedChangeListener mInputModeListener = new RadioGroupSetting.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId, boolean doApply) {
setInputMode(checkedId, doApply);
}
};

private RadioGroupSetting.OnCheckedChangeListener mEnvsListener = new RadioGroupSetting.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId, boolean doApply) {
Expand Down Expand Up @@ -336,7 +323,6 @@ public void onClick(View view) {
// Radios
setUaMode(mUaModeRadio.getIdForValue(SettingsStore.UA_MODE_DEFAULT), true);
setMSAAMode(mMSAARadio.getIdForValue(SettingsStore.MSAA_DEFAULT_LEVEL), true);
setInputMode(mEventsRadio.getIdForValue(SettingsStore.INPUT_MODE_DEFAULT), false);

// Edits
restart = restart | setDisplayDensity(SettingsStore.DISPLAY_DENSITY_DEFAULT);
Expand Down Expand Up @@ -452,15 +438,6 @@ private void setPointerColor(int checkedId, boolean doApply) {
}
}

private void setInputMode(int checkedId, boolean doApply) {
mEventsRadio.setOnCheckedChangeListener(null);
mEventsRadio.setChecked(checkedId, doApply);
mEventsRadio.setOnCheckedChangeListener(mInputModeListener);

SettingsStore.getInstance(getContext()).setInputMode((Integer)mEventsRadio.getValueForId(checkedId));
// TODO: Wire it up
}

private boolean setDisplayDensity(float newDensity) {
mDensityEdit.setOnClickListener((SingleEditSetting.OnClickListener)null);
boolean restart = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.CursorAnchorInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
import android.widget.ImageButton;

import android.widget.ImageView;
import android.widget.RelativeLayout;

import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.browser.SessionStore;
Expand All @@ -46,7 +45,6 @@ public class KeyboardWidget extends UIWidget implements CustomKeyboardView.OnKey
private CustomKeyboard mKeyboardQuerty;
private CustomKeyboard mKeyboardSymbols1;
private CustomKeyboard mKeyboardSymbols2;
private ViewGroup mVoiceInput;
private Drawable mShiftOnIcon;
private Drawable mShiftOffIcon;
private Drawable mCapsLockOnIcon;
Expand Down Expand Up @@ -87,7 +85,6 @@ private void initialize(Context aContext) {

mKeyboardview = findViewById(R.id.keyboard);
mPopupKeyboardview = findViewById(R.id.popupKeyboard);
mVoiceInput = findViewById(R.id.keyboard_microphone);
mPopupKeyboardLayer = findViewById(R.id.popupKeyboardLayer);

mKeyboardQuerty = new CustomKeyboard(aContext.getApplicationContext(), R.xml.keyboard_qwerty);
Expand Down Expand Up @@ -144,15 +141,6 @@ public void onClick(View v) {
}
});

mKeyboardIcon = findViewById(R.id.keyboard_icon);
mKeyboardIcon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mKeyboardview.setVisibility(View.VISIBLE);
mVoiceInput.setVisibility(View.GONE);
}
});

mKeyboardPopupLeftMargin = getResources().getDimensionPixelSize(R.dimen.keyboard_popup_left_margin);
mKeyboardPopupTopMargin = getResources().getDimensionPixelSize(R.dimen.keyboard_key_pressed_padding) * 2;

Expand All @@ -168,7 +156,6 @@ public void onClick(View view) {
mKeyboardview.setVisibility(View.VISIBLE);
mPopupKeyboardview.setVisibility(View.GONE);
mPopupKeyboardLayer.setVisibility(View.GONE);
mVoiceInput.setVisibility(View.GONE);

mBackHandler = new Runnable() {
@Override
Expand Down Expand Up @@ -534,7 +521,6 @@ public void run() {

private void handleVoiceInput() {
mKeyboardview.setVisibility(View.GONE);
mVoiceInput.setVisibility(View.VISIBLE);
TelemetryWrapper.voiceInputEvent();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.VRBrowserActivity;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.ui.views.UIButton;

public class RestartDialogWidget extends UIWidget {

private static final String LOGTAG = "VRB";

private TextView mAcceptButton;
private UIButton mCancelButton;
private AudioEngine mAudio;

public RestartDialogWidget(Context aContext) {
Expand All @@ -42,34 +41,25 @@ public RestartDialogWidget(Context aContext, AttributeSet aAttrs, int aDefStyle)
private void initialize(Context aContext) {
inflate(aContext, R.layout.restart_dialog, this);

mAcceptButton = findViewById(R.id.crashAcceptButton);
mCancelButton = findViewById(R.id.crashCancelButton);

mAcceptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

getHandler().postDelayed(new Runnable() {
@Override
public void run() {
handleRestartApp();
}
}, 500);
TextView acceptButton = findViewById(R.id.crashAcceptButton);
UIButton cancelButton = findViewById(R.id.crashCancelButton);
TextView restartText = findViewById(R.id.restartText);

acceptButton.setOnClickListener(view -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

getHandler().postDelayed(() -> handleRestartApp(), 500);
});
mCancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

onDismiss();
cancelButton.setOnClickListener(view -> {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

onDismiss();
});
restartText.setText(getContext().getString(R.string.restart_dialog_text, getContext().getString(R.string.app_name)));

mAudio = AudioEngine.fromContext(aContext);
}
Expand Down
Loading

0 comments on commit 60c159d

Please sign in to comment.