This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
c70b206
commit 7686578
Showing
63 changed files
with
923 additions
and
944 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
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
99 changes: 99 additions & 0 deletions
99
app/src/common/shared/org/mozilla/vrbrowser/ui/views/HoneycombButton.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,99 @@ | ||
package org.mozilla.vrbrowser.ui.views; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.graphics.PorterDuff; | ||
import android.graphics.PorterDuffColorFilter; | ||
import android.graphics.drawable.Drawable; | ||
import android.support.annotation.Nullable; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
import android.view.View; | ||
import android.widget.ImageView; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
import org.mozilla.vrbrowser.R; | ||
import org.mozilla.vrbrowser.audio.AudioEngine; | ||
|
||
public class HoneycombButton extends LinearLayout { | ||
|
||
private ImageView mIcon; | ||
private TextView mText; | ||
private TextView mSecondaryText; | ||
private String mButtonText; | ||
private float mButtonTextSize; | ||
private String mSecondaryButtonText; | ||
private Drawable mButtonIcon; | ||
private AudioEngine mAudio; | ||
|
||
public HoneycombButton(Context context, @Nullable AttributeSet attrs) { | ||
this(context, attrs, R.style.settingsButtonTheme); | ||
} | ||
|
||
public HoneycombButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.HoneycombButton, defStyleAttr, 0); | ||
mButtonText = attributes.getString(R.styleable.HoneycombButton_honeycombButtonText); | ||
mButtonTextSize = attributes.getDimension(R.styleable.HoneycombButton_honeycombButtonTextSize, 0.0f); | ||
mButtonIcon = attributes.getDrawable(R.styleable.HoneycombButton_honeycombButtonIcon); | ||
mSecondaryButtonText = attributes.getString(R.styleable.HoneycombButton_honeycombSecondaryText); | ||
initialize(context); | ||
} | ||
|
||
private void initialize(Context aContext) { | ||
inflate(aContext, R.layout.honeycomb_button, this); | ||
|
||
mAudio = AudioEngine.fromContext(aContext); | ||
|
||
setClickable(true); | ||
|
||
mIcon = findViewById(R.id.settings_button_icon); | ||
if (mIcon != null) | ||
mIcon.setImageDrawable(mButtonIcon); | ||
|
||
mText = findViewById(R.id.settings_button_text); | ||
if (mText != null) { | ||
mText.setText(mButtonText); | ||
if (mButtonTextSize > 0) { | ||
mText.getLayoutParams().width = (int) mButtonTextSize; | ||
} | ||
} | ||
|
||
mSecondaryText = findViewById(R.id.settings_secondary_text); | ||
if (mSecondaryText != null) | ||
mSecondaryText.setText(mSecondaryButtonText); | ||
|
||
setOnHoverListener((view, motionEvent) -> false); | ||
|
||
setSoundEffectsEnabled(false); | ||
} | ||
|
||
@Override | ||
public void setOnHoverListener(final OnHoverListener l) { | ||
super.setOnHoverListener((view, motionEvent) -> { | ||
switch (motionEvent.getAction()) { | ||
case MotionEvent.ACTION_HOVER_ENTER: | ||
if (mIcon != null && mText != null) { | ||
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.asphalt, getContext().getTheme()), PorterDuff.Mode.MULTIPLY)); | ||
mText.setTextColor(getContext().getColor(R.color.asphalt)); | ||
mSecondaryText.setTextColor(getContext().getColor(R.color.asphalt)); | ||
} | ||
break; | ||
case MotionEvent.ACTION_HOVER_EXIT: | ||
if (mIcon != null && mText != null) { | ||
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.fog, getContext().getTheme()), PorterDuff.Mode.MULTIPLY)); | ||
mText.setTextColor(getContext().getColor(R.color.fog)); | ||
mSecondaryText.setTextColor(getContext().getColor(R.color.fog)); | ||
} | ||
break; | ||
} | ||
|
||
return l.onHover(view, motionEvent); | ||
}); | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent ev) { | ||
return true; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
app/src/common/shared/org/mozilla/vrbrowser/ui/views/HoneycombSwitch.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,76 @@ | ||
package org.mozilla.vrbrowser.ui.views; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.support.annotation.Nullable; | ||
import android.util.AttributeSet; | ||
import android.widget.CompoundButton; | ||
import android.widget.LinearLayout; | ||
import android.widget.Switch; | ||
import android.widget.TextView; | ||
|
||
import org.mozilla.vrbrowser.R; | ||
import org.mozilla.vrbrowser.audio.AudioEngine; | ||
|
||
public class HoneycombSwitch extends LinearLayout { | ||
|
||
public interface OnCheckedChangeListener { | ||
void onCheckedChanged(CompoundButton compoundButton, boolean b); | ||
} | ||
|
||
private TextView mText; | ||
private TextView mStateText; | ||
private Switch mSwitch; | ||
private String mSwitchText; | ||
private float mSwitchTextSize; | ||
private OnCheckedChangeListener mSwitchListener; | ||
|
||
public HoneycombSwitch(Context context, @Nullable AttributeSet attrs) { | ||
this(context, attrs, R.style.settingsButtonTheme); | ||
} | ||
|
||
public HoneycombSwitch(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.HoneycombSwitch, defStyleAttr, 0); | ||
mSwitchText = attributes.getString(R.styleable.HoneycombSwitch_honeycombSwitchText); | ||
mSwitchTextSize = attributes.getDimension(R.styleable.HoneycombSwitch_honeycombSwitchTextSize, 0.0f); | ||
initialize(context); | ||
} | ||
|
||
private void initialize(Context aContext) { | ||
inflate(aContext, R.layout.honeycomb_switch, this); | ||
|
||
mSwitch = findViewById(R.id.honeycombSwitchButton); | ||
mSwitch.setOnCheckedChangeListener(mInternalSwitchListener); | ||
mSwitch.setSoundEffectsEnabled(false); | ||
|
||
mText = findViewById(R.id.honeycombSwitchText); | ||
if (mText != null) { | ||
mText.setText(mSwitchText); | ||
if (mSwitchTextSize > 0) { | ||
mText.getLayoutParams().width = (int) mSwitchTextSize; | ||
} | ||
} | ||
|
||
mStateText = findViewById(R.id.honeycombSwitchStateText); | ||
} | ||
|
||
private CompoundButton.OnCheckedChangeListener mInternalSwitchListener = new CompoundButton.OnCheckedChangeListener() { | ||
@Override | ||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) { | ||
mStateText.setText(b ? | ||
getContext().getString(R.string.on).toUpperCase() : | ||
getContext().getString(R.string.off).toUpperCase()); | ||
|
||
if (mSwitchListener != null) { | ||
mSwitchListener.onCheckedChanged(compoundButton, b); | ||
} | ||
|
||
} | ||
}; | ||
|
||
public void setOnCheckedChangeListener(OnCheckedChangeListener aListener) { | ||
mSwitchListener = aListener; | ||
} | ||
|
||
} |
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
104 changes: 0 additions & 104 deletions
104
app/src/common/shared/org/mozilla/vrbrowser/ui/views/SettingsButton.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.