diff options
| author | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2023-10-11 14:41:33 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2023-10-12 14:01:28 +0200 |
| commit | b3e63bb0cc97d7486d88ddf2d927cd5ae116c075 (patch) | |
| tree | b450ee577d35cf479fe3f953ff989f6b5d6e0211 /android | |
| parent | 30b81b081df1694229c9fd1995030ce1fab851b9 (diff) | |
| download | mullvadvpn-b3e63bb0cc97d7486d88ddf2d927cd5ae116c075.tar.xz mullvadvpn-b3e63bb0cc97d7486d88ddf2d927cd5ae116c075.zip | |
Remove unused classes and resources
Diffstat (limited to 'android')
55 files changed, 7 insertions, 1409 deletions
diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/RecyclerViewMatcher.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/RecyclerViewMatcher.kt deleted file mode 100644 index c5093f3ceb..0000000000 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/RecyclerViewMatcher.kt +++ /dev/null @@ -1,52 +0,0 @@ -package net.mullvad.mullvadvpn - -import android.content.res.Resources -import android.content.res.Resources.NotFoundException -import android.view.View -import androidx.recyclerview.widget.RecyclerView -import org.hamcrest.Description -import org.hamcrest.Matcher -import org.hamcrest.TypeSafeMatcher - -class RecyclerViewMatcher(private val recyclerViewId: Int) { - fun atPosition(position: Int): Matcher<View> { - return atPositionOnView(position) - } - - fun atPositionOnView(position: Int, targetViewId: Int? = null): Matcher<View> = - object : TypeSafeMatcher<View>() { - var resources: Resources? = null - var childView: View? = null - - override fun describeTo(description: Description) { - val idDescription = - resources?.let { - try { - it.getResourceName(recyclerViewId) - } catch (var4: NotFoundException) { - "$recyclerViewId (resource name not found)" - } - } - ?: recyclerViewId.toString() - description.appendText("with id: $idDescription") - } - - override fun matchesSafely(view: View): Boolean { - resources = view.resources - val recyclerView = view.rootView.findViewById<View>(recyclerViewId) as RecyclerView? - if (recyclerView == null || recyclerView.id != recyclerViewId) { - return false - } - childView = recyclerView.findViewHolderForAdapterPosition(position)?.itemView - val targetView = - targetViewId?.let { id -> childView?.findViewById<View>(id) } ?: childView - return view == targetView - } - } - - companion object { - fun withRecyclerView(recyclerViewId: Int): RecyclerViewMatcher { - return RecyclerViewMatcher(recyclerViewId) - } - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/CustomTransformationMethod.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/CustomTransformationMethod.kt deleted file mode 100644 index 451c51fa3f..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/CustomTransformationMethod.kt +++ /dev/null @@ -1,50 +0,0 @@ -package net.mullvad.mullvadvpn.ui - -import android.graphics.Rect -import android.text.method.PasswordTransformationMethod -import android.text.method.TransformationMethod -import android.view.View - -private const val BIG_DOT_CHAR = '●' -private const val DOT_CHAR = '\u2022' -private const val EMPTY_STRING = "" -private const val SPACE_CHAR = ' ' - -class GroupedTransformationMethod : TransformationMethod { - override fun getTransformation(source: CharSequence?, view: View?): CharSequence { - return source?.groupWithSpaces() ?: EMPTY_STRING - } - - override fun onFocusChanged( - view: View?, - sourceText: CharSequence?, - focused: Boolean, - direction: Int, - previouslyFocusedRect: Rect? - ) { - // No focus handling required. - } -} - -class GroupedPasswordTransformationMethod : PasswordTransformationMethod() { - override fun getTransformation(source: CharSequence?, view: View?): CharSequence { - return if (source != null && view != null) { - super.getTransformation(source, view) - ?.toString() - ?.replace(DOT_CHAR, BIG_DOT_CHAR) - ?.groupWithSpaces() - ?: EMPTY_STRING - } else { - EMPTY_STRING - } - } -} - -private fun CharSequence.groupWithSpaces(groupCharSize: Int = 4): CharSequence { - return fold(StringBuilder()) { formattedText, nextDigit -> - if ((formattedText.length % (groupCharSize + 1)) == groupCharSize) { - formattedText.append(SPACE_CHAR) - } - formattedText.append(nextDigit) - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt deleted file mode 100644 index 1047793f6f..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt +++ /dev/null @@ -1,10 +0,0 @@ -package net.mullvad.mullvadvpn.ui - -import android.app.Activity -import androidx.annotation.ColorInt - -interface NavigationBarPainter : SystemPainter - -fun NavigationBarPainter.paintNavigationBar(@ColorInt color: Int) { - (getContext() as Activity?)?.window?.navigationBarColor = color -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt deleted file mode 100644 index 48f94e17b5..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt +++ /dev/null @@ -1,10 +0,0 @@ -package net.mullvad.mullvadvpn.ui - -import android.app.Activity -import androidx.annotation.ColorInt - -interface StatusBarPainter : SystemPainter - -fun StatusBarPainter.paintStatusBar(@ColorInt color: Int) { - (getContext() as Activity?)?.window?.statusBarColor = color -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt deleted file mode 100644 index 2f0fc32775..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt +++ /dev/null @@ -1,7 +0,0 @@ -package net.mullvad.mullvadvpn.ui - -import android.content.Context - -interface SystemPainter { - fun getContext(): Context? -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/AccountFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/AccountFragment.kt index b0784d62a9..3bd46d9f52 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/AccountFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/AccountFragment.kt @@ -11,13 +11,11 @@ import androidx.compose.ui.platform.ComposeView import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.AccountScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme -import net.mullvad.mullvadvpn.ui.NavigationBarPainter -import net.mullvad.mullvadvpn.ui.StatusBarPainter import net.mullvad.mullvadvpn.ui.extension.requireMainActivity import net.mullvad.mullvadvpn.viewmodel.AccountViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class AccountFragment : BaseFragment(), StatusBarPainter, NavigationBarPainter { +class AccountFragment : BaseFragment() { private val vm by viewModel<AccountViewModel>() @OptIn(ExperimentalMaterial3Api::class) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/ConnectFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/ConnectFragment.kt index afb2ec9d94..374b27e668 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/ConnectFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/ConnectFragment.kt @@ -12,12 +12,11 @@ import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.ConnectScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.ui.MainActivity -import net.mullvad.mullvadvpn.ui.NavigationBarPainter import net.mullvad.mullvadvpn.util.appendHideNavOnPlayBuild import net.mullvad.mullvadvpn.viewmodel.ConnectViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class ConnectFragment : BaseFragment(), NavigationBarPainter { +class ConnectFragment : BaseFragment() { // Injected dependencies private val connectViewModel: ConnectViewModel by viewModel() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoadingFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoadingFragment.kt index 0000351c33..d2f0cbfb6e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoadingFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoadingFragment.kt @@ -10,10 +10,8 @@ import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.LoadingScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.ui.MainActivity -import net.mullvad.mullvadvpn.ui.NavigationBarPainter -import net.mullvad.mullvadvpn.ui.StatusBarPainter -class LoadingFragment : Fragment(), StatusBarPainter, NavigationBarPainter { +class LoadingFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoginFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoginFragment.kt index 9fd6e5aceb..92d58066ee 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoginFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/LoginFragment.kt @@ -13,12 +13,11 @@ import net.mullvad.mullvadvpn.compose.screen.LoginScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.model.AccountToken import net.mullvad.mullvadvpn.ui.MainActivity -import net.mullvad.mullvadvpn.ui.NavigationBarPainter import net.mullvad.mullvadvpn.viewmodel.LoginUiSideEffect import net.mullvad.mullvadvpn.viewmodel.LoginViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class LoginFragment : BaseFragment(), NavigationBarPainter { +class LoginFragment : BaseFragment() { private val vm: LoginViewModel by viewModel() override fun onCreateView( diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/PrivacyDisclaimerFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/PrivacyDisclaimerFragment.kt index 4b500d3f58..ed45382013 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/PrivacyDisclaimerFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/PrivacyDisclaimerFragment.kt @@ -13,13 +13,11 @@ import net.mullvad.mullvadvpn.compose.screen.PrivacyDisclaimerScreen import net.mullvad.mullvadvpn.lib.endpoint.getApiEndpointConfigurationExtras import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.ui.MainActivity -import net.mullvad.mullvadvpn.ui.NavigationBarPainter -import net.mullvad.mullvadvpn.ui.StatusBarPainter import net.mullvad.mullvadvpn.util.appendHideNavOnPlayBuild import net.mullvad.mullvadvpn.viewmodel.PrivacyDisclaimerViewModel import org.koin.android.ext.android.inject -class PrivacyDisclaimerFragment : Fragment(), StatusBarPainter, NavigationBarPainter { +class PrivacyDisclaimerFragment : Fragment() { private val privacyDisclaimerViewModel: PrivacyDisclaimerViewModel by inject() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt index d56b51850b..d1c4ac72bf 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt @@ -9,12 +9,10 @@ import androidx.compose.ui.platform.ComposeView import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.SelectLocationScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme -import net.mullvad.mullvadvpn.ui.NavigationBarPainter -import net.mullvad.mullvadvpn.ui.StatusBarPainter import net.mullvad.mullvadvpn.viewmodel.SelectLocationViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class SelectLocationFragment : BaseFragment(), StatusBarPainter, NavigationBarPainter { +class SelectLocationFragment : BaseFragment() { private val vm by viewModel<SelectLocationViewModel>() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SettingsFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SettingsFragment.kt index 64b3e6b425..e5faf6bb11 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SettingsFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SettingsFragment.kt @@ -11,12 +11,10 @@ import androidx.fragment.app.Fragment import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.SettingsScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme -import net.mullvad.mullvadvpn.ui.NavigationBarPainter -import net.mullvad.mullvadvpn.ui.StatusBarPainter import net.mullvad.mullvadvpn.viewmodel.SettingsViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class SettingsFragment : BaseFragment(), StatusBarPainter, NavigationBarPainter { +class SettingsFragment : BaseFragment() { private val vm by viewModel<SettingsViewModel>() @OptIn(ExperimentalMaterial3Api::class) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/BackButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/BackButton.kt deleted file mode 100644 index efa2d6f5a6..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/BackButton.kt +++ /dev/null @@ -1,75 +0,0 @@ -package net.mullvad.mullvadvpn.ui.widget - -import android.content.Context -import android.util.AttributeSet -import android.util.TypedValue -import android.view.Gravity -import android.view.LayoutInflater -import android.widget.LinearLayout -import android.widget.TextView -import net.mullvad.mullvadvpn.R - -class BackButton : LinearLayout { - private val container = - context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).let { service -> - val inflater = service as LayoutInflater - - inflater.inflate(R.layout.settings_back_button, this) - } - - private val label = container.findViewById<TextView>(R.id.label) - - constructor(context: Context) : super(context) - - constructor(context: Context, attributes: AttributeSet) : super(context, attributes) { - loadAttributes(attributes) - } - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int - ) : super(context, attributes, defaultStyleAttribute) { - loadAttributes(attributes) - } - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int, - defaultStyleResource: Int - ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) { - loadAttributes(attributes) - } - - init { - isFocusable = true - isClickable = true - gravity = Gravity.CENTER_VERTICAL or Gravity.START - orientation = HORIZONTAL - - resources.getDimensionPixelSize(R.dimen.settings_back_button_padding).let { padding -> - setPadding(padding, padding, padding, padding) - } - - loadBackground() - } - - private fun loadAttributes(attributes: AttributeSet) { - context.theme.obtainStyledAttributes(attributes, R.styleable.TextAttribute, 0, 0).apply { - try { - label.text = getString(R.styleable.TextAttribute_text) ?: "" - } finally { - recycle() - } - } - } - - private fun loadBackground() { - val typedValue = TypedValue() - - context.theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true) - - setBackgroundResource(typedValue.resourceId) - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt deleted file mode 100644 index e6c266683b..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt +++ /dev/null @@ -1,171 +0,0 @@ -package net.mullvad.mullvadvpn.ui.widget - -import android.content.Context -import android.graphics.drawable.Drawable -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.ImageView -import net.mullvad.mullvadvpn.R -import net.mullvad.mullvadvpn.lib.common.util.JobTracker - -open class Button : FrameLayout { - enum class ButtonColor { - Blue, - Green, - Red; - - companion object { - internal fun fromCode(code: Int): ButtonColor { - when (code) { - 0 -> return Blue - 1 -> return Green - 2 -> return Red - else -> throw Exception("Invalid buttonColor attribute value") - } - } - } - } - - private val container = - context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).let { service -> - val inflater = service as LayoutInflater - - inflater.inflate(R.layout.button, this) - } - - private val button = container.findViewById<android.widget.Button>(R.id.button) - private val spinner: View = container.findViewById(R.id.spinner) - private val image: ImageView = container.findViewById(R.id.image) - - private var clickJobName: String? = null - private var onClickAction: (suspend () -> Unit)? = null - - protected var jobTracker: JobTracker? = null - - var buttonColor: ButtonColor = ButtonColor.Blue - set(value) { - field = value - - val backgroundResource = - when (value) { - ButtonColor.Blue -> R.drawable.blue_button_background - ButtonColor.Green -> R.drawable.green_button_background - ButtonColor.Red -> R.drawable.red_button_background - } - - button.setBackgroundResource(backgroundResource) - } - - var detailImage: Drawable? = null - set(value) { - field = value - - image.apply { - if (value == null) { - visibility = GONE - } else { - visibility = VISIBLE - setImageDrawable(value) - } - } - } - - var label: CharSequence - get() = button.text - set(value) { - button.text = value - } - - var showSpinner = false - - constructor(context: Context) : super(context) - - constructor(context: Context, attributes: AttributeSet) : super(context, attributes) { - loadAttributes(attributes) - } - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int - ) : super(context, attributes, defaultStyleAttribute) { - loadAttributes(attributes) - } - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int, - defaultStyleResource: Int - ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) { - loadAttributes(attributes) - } - - override fun setEnabled(enabled: Boolean) { - super.setEnabled(enabled) - button.isEnabled = enabled - - if (enabled) { - alpha = 1.0f - } else { - alpha = 0.5f - } - } - - init { - button.setOnClickListener { - jobTracker?.newUiJob(clickJobName!!) { - isEnabled = false - - if (showSpinner) { - image.visibility = GONE - spinner.visibility = VISIBLE - } - - onClickAction!!.invoke() - - spinner.visibility = GONE - - if (detailImage != null) { - image.visibility = VISIBLE - } - - isEnabled = true - } - } - } - - fun setOnClickAction(jobName: String, tracker: JobTracker, action: suspend () -> Unit) { - clickJobName = jobName - jobTracker = tracker - onClickAction = action - } - - fun setText(textResource: Int) { - button.setText(textResource) - } - - private fun loadAttributes(attributes: AttributeSet) { - var styleableId = R.styleable.Button - - context.theme.obtainStyledAttributes(attributes, styleableId, 0, 0).apply { - try { - buttonColor = ButtonColor.fromCode(getInteger(R.styleable.Button_buttonColor, 0)) - detailImage = getDrawable(R.styleable.Button_detailImage) - showSpinner = getBoolean(R.styleable.Button_showSpinner, false) - } finally { - recycle() - } - } - - context.theme.obtainStyledAttributes(attributes, R.styleable.TextAttribute, 0, 0).apply { - try { - button.text = getString(R.styleable.TextAttribute_text) ?: "" - } finally { - recycle() - } - } - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt deleted file mode 100644 index 788bc92691..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/HeaderBar.kt +++ /dev/null @@ -1,73 +0,0 @@ -package net.mullvad.mullvadvpn.ui.widget - -import android.content.Context -import android.util.AttributeSet -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.widget.LinearLayout -import androidx.core.content.ContextCompat -import androidx.core.view.isVisible -import kotlin.properties.Delegates.observable -import net.mullvad.mullvadvpn.R -import net.mullvad.mullvadvpn.model.TunnelState -import net.mullvad.mullvadvpn.ui.MainActivity -import net.mullvad.mullvadvpn.ui.StatusBarPainter -import net.mullvad.mullvadvpn.ui.paintStatusBar - -class HeaderBar -@JvmOverloads -constructor( - context: Context, - attributes: AttributeSet? = null, - defStyleAttr: Int = 0, - defStyleRes: Int = 0 -) : LinearLayout(context, attributes, defStyleAttr, defStyleRes), StatusBarPainter { - private val container = LayoutInflater.from(context).inflate(R.layout.header_bar, this) - private val settingsButton = findViewById<View>(R.id.settings) - private val accountButton = findViewById<View>(R.id.account) - - private val disabledColor = ContextCompat.getColor(context, android.R.color.transparent) - private val securedColor = ContextCompat.getColor(context, R.color.green) - private val unsecuredColor = ContextCompat.getColor(context, R.color.red) - - var tunnelState by - observable<TunnelState?>(null) { _, _, state -> - val backgroundColor = - if (state == null) { - disabledColor - } else if (state.isSecured()) { - securedColor - } else { - unsecuredColor - } - - container.setBackgroundColor(backgroundColor) - paintStatusBar(backgroundColor) - } - - init { - gravity = Gravity.CENTER_VERTICAL - orientation = HORIZONTAL - - accountButton.apply { - isEnabled = true - setOnClickListener { (context as? MainActivity)?.openAccount() } - } - - settingsButton.apply { - isEnabled = true - setOnClickListener { (context as? MainActivity)?.openSettings() } - } - - tunnelState = null - } - - fun setAccountButtonVisibility(isVisible: Boolean) { - accountButton.isVisible = isVisible - } - - fun setSettingsButtonEnabled(isEnabled: Boolean) { - settingsButton.isEnabled = isEnabled - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt deleted file mode 100644 index 0b65325f42..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt +++ /dev/null @@ -1,31 +0,0 @@ -package net.mullvad.mullvadvpn.ui.widget - -import android.content.Context -import android.util.AttributeSet -import android.widget.ScrollView -import net.mullvad.mullvadvpn.util.ListenableScrollableView - -class ListenableScrollView : ScrollView, ListenableScrollableView { - override val horizontalScrollOffset - get() = scrollX - - override val verticalScrollOffset - get() = scrollY - - override var onScrollListener: ((Int, Int, Int, Int) -> Unit)? = null - - constructor(context: Context) : super(context) - - constructor(context: Context, attributes: AttributeSet) : super(context, attributes) - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int - ) : super(context, attributes, defaultStyleAttribute) - - override fun onScrollChanged(left: Int, top: Int, oldLeft: Int, oldTop: Int) { - super.onScrollChanged(left, top, oldLeft, oldTop) - onScrollListener?.invoke(left, top, oldLeft, oldTop) - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/Debouncer.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/Debouncer.kt deleted file mode 100644 index 4d0406cdc3..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/Debouncer.kt +++ /dev/null @@ -1,41 +0,0 @@ -package net.mullvad.mullvadvpn.util - -import kotlin.properties.Delegates.observable -import kotlinx.coroutines.delay -import net.mullvad.mullvadvpn.lib.common.util.JobTracker - -// Helper to filter out bursts of events so that only the latest event in an interval is notified. -// -// An interval of zero means that it will only debounce events that are sent before the job is -// started. If the events are coming from the UI thread, this means that this class will only send -// the last event received before the UI thread finishes its current task. -// -// This can be used for example to filter out focus events coming from different views. Android will -// first send a "focus lost" event from a view followed by a "focus gained" event from another view. -// If the only thing the listener is interested in is if any of a set of views has focus, this class -// can be used to debounce focus events from the set of views to obtain an event that represents a -// change from when the set contains a focused view to when the set contains no focused views (and -// an event for the reverse situation). -class Debouncer<T>(initialValue: T, val intervalInMs: Long = 0) { - private val jobTracker = JobTracker() - - var listener: ((T) -> Unit)? = null - - var debouncedValue = initialValue - private set - - var rawValue by - observable(initialValue) { _, oldValue, newValue -> - if (newValue != oldValue) { - jobTracker.cancelJob("notifyNewValue") - - if (newValue != debouncedValue) { - jobTracker.newUiJob("notifyNewValue") { - delay(intervalInMs) - listener?.invoke(newValue) - debouncedValue = newValue - } - } - } - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/LinearInterpolation.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/LinearInterpolation.kt deleted file mode 100644 index ff03844e91..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/LinearInterpolation.kt +++ /dev/null @@ -1,46 +0,0 @@ -package net.mullvad.mullvadvpn.util - -import kotlin.properties.Delegates.observable -import kotlin.reflect.KProperty - -class LinearInterpolation { - private val observer = { _: KProperty<*>, oldValue: Float, newValue: Float -> - if (!updated && oldValue != newValue) { - updated = true - } - } - - private val realStart - get() = start - reference - - private val realEnd - get() = end - reference - - var reference by observable(0.0f, observer) - var start by observable(0.0f, observer) - var end by observable(0.0f, observer) - - var updated = true - get() { - return if (field) { - field = false - true - } else { - false - } - } - - fun interpolate(progress: Float): Float { - return progress * (realEnd - realStart) + realStart - } - - fun progress(interpolation: Float): Float { - val length = realEnd - realStart - - if (length == 0.0f) { - return 0.0f - } - - return (interpolation - realStart) / length - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ListenableScrollableView.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ListenableScrollableView.kt deleted file mode 100644 index 61deecacb2..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ListenableScrollableView.kt +++ /dev/null @@ -1,8 +0,0 @@ -package net.mullvad.mullvadvpn.util - -interface ListenableScrollableView { - val horizontalScrollOffset: Int - val verticalScrollOffset: Int - - var onScrollListener: ((Int, Int, Int, Int) -> Unit)? -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedInputFormatter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedInputFormatter.kt deleted file mode 100644 index 6d3a3e5cc8..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedInputFormatter.kt +++ /dev/null @@ -1,147 +0,0 @@ -package net.mullvad.mullvadvpn.util - -import android.text.Editable -import android.text.TextWatcher -import android.widget.EditText -import java.util.Locale - -class SegmentedInputFormatter(val input: EditText, var separator: Char) : TextWatcher { - private var editing = false - private var removing = false - private var separatorSkipCount = 5 - - var allCaps = false - var isValidInputCharacter: (Char) -> Boolean = { _ -> true } - - var segmentSize = 4 - set(value) { - field = value - separatorSkipCount = value + 1 - } - - init { - input.addTextChangedListener(this) - } - - override fun beforeTextChanged(text: CharSequence, start: Int, count: Int, after: Int) { - if (!editing) { - editing = true - removing = after < count - } - } - - override fun onTextChanged(text: CharSequence, start: Int, before: Int, count: Int) {} - - override fun afterTextChanged(text: Editable) { - val string = text.toString() - - if (isValidInput(string)) { - editing = false - maybeUpdateSelection(text) - } else { - formatInput(text) - } - } - - private fun maybeUpdateSelection(text: Editable) { - if (removing) { - var start = input.selectionStart - var end = input.selectionEnd - var changed = false - - if (start % separatorSkipCount == 0 && start > 0) { - start -= 1 - changed = true - } - - if (end % separatorSkipCount == 0 && end > 0) { - end -= 1 - changed = true - } - - if (changed) { - input.setSelection(start, end) - - if (start == end && end == text.length - 1) { - // The cursor was previously at the last character, and now after the character - // was removed it has been moved to before the separator. It's best now to - // remove the unnecessary trailing separator - text.delete(text.length - 1, text.length) - } - } - } - } - - private fun isValidInput(string: String): Boolean { - return string.asSequence().withIndex().all { item -> - val index = item.index - val character = item.value - - if ((index + 1) % separatorSkipCount == 0) { - character == separator - } else { - isValidInputCharacter(character) - } - } - } - - private fun formatInput(input: Editable) { - var index = 0 - val length = input.length - var changed = false - - while (index < length && !changed) { - val segmentStart = index - val segmentEnd = index + segmentSize - 1 - val separatorPosition = segmentEnd + 1 - - changed = - formatSegment(input, segmentStart..segmentEnd) || - formatSeparator(input, separatorPosition) - - index = separatorPosition + 1 - } - } - - private fun formatSegment(input: Editable, range: IntRange): Boolean { - val length = input.length - val start = range.start - var end = range.endInclusive - - if (start < length) { - end = minOf(end, length - 1) - - for (index in start..end) { - val character = input[index] - - if (allCaps && character >= 'a' && character <= 'z') { - input.replace( - index, - index + 1, - character.toString().uppercase(Locale.getDefault()) - ) - } else if (!isValidInputCharacter(character)) { - input.delete(index, index + 1) - } else { - // Only continue looping if no changes were made to the string - continue - } - - // Abort loop because the input was edited and `afterTextChanged` will be called - // again - return true - } - } - - return false - } - - private fun formatSeparator(input: Editable, index: Int): Boolean { - if (index < input.length && input[index] != separator) { - input.insert(index, "$separator") - return true - } else { - return false - } - } -} diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedTextFormatter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedTextFormatter.kt deleted file mode 100644 index 4ba6fe97e0..0000000000 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SegmentedTextFormatter.kt +++ /dev/null @@ -1,14 +0,0 @@ -package net.mullvad.mullvadvpn.util - -class SegmentedTextFormatter(var separator: Char) { - var isValidInputCharacter: (Char) -> Boolean = { _ -> true } - var segmentSize = 4 - - fun format(string: String) = - string - .asSequence() - .filter(isValidInputCharacter) - .chunked(segmentSize) - .map { segmentCharacters -> segmentCharacters.joinToString("") } - .joinToString("$separator") -} diff --git a/android/app/src/main/res/layout/button.xml b/android/app/src/main/res/layout/button.xml deleted file mode 100644 index 5db4501a46..0000000000 --- a/android/app/src/main/res/layout/button.xml +++ /dev/null @@ -1,23 +0,0 @@ -<merge xmlns:android="http://schemas.android.com/apk/res/android"> - <Button android:id="@+id/button" - android:gravity="center" - android:text="" - style="@style/Button" /> - <ProgressBar android:id="@+id/spinner" - android:layout_width="20dp" - android:layout_height="20dp" - android:layout_marginHorizontal="9dp" - android:layout_gravity="end|center_vertical" - android:indeterminate="true" - android:indeterminateOnly="true" - android:indeterminateDuration="600" - android:indeterminateDrawable="@drawable/icon_spinner" - android:visibility="gone" /> - <ImageView android:id="@+id/image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginHorizontal="9dp" - android:layout_gravity="end|center_vertical" - android:src="@android:color/transparent" - android:visibility="gone" /> -</merge> diff --git a/android/app/src/main/res/layout/header_bar.xml b/android/app/src/main/res/layout/header_bar.xml deleted file mode 100644 index f040afd9cb..0000000000 --- a/android/app/src/main/res/layout/header_bar.xml +++ /dev/null @@ -1,46 +0,0 @@ -<merge xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" - android:layout_height="@dimen/top_bar_height"> - - <ImageView android:id="@+id/appIcon" - android:layout_width="44dp" - android:layout_height="44dp" - android:src="@drawable/logo_icon" - android:layout_marginStart="16dp" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" /> - <ImageView android:id="@+id/appLogo" - android:layout_height="16dp" - android:layout_width="wrap_content" - android:adjustViewBounds="true" - android:scaleType="fitCenter" - android:src="@drawable/logo_text" - android:layout_marginStart="8dp" - android:alpha="0.8" - app:layout_constraintStart_toEndOf="@id/appIcon" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" /> - <ImageButton android:id="@+id/account" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:background="?android:attr/selectableItemBackground" - android:paddingHorizontal="16dp" - android:src="@drawable/icon_account" - app:layout_constraintEnd_toStartOf="@id/settings" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - android:contentDescription="@string/settings_account" /> - <ImageButton android:id="@+id/settings" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:background="?android:attr/selectableItemBackground" - android:paddingHorizontal="16dp" - android:src="@drawable/icon_settings" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - android:contentDescription="@string/settings" /> - </androidx.constraintlayout.widget.ConstraintLayout> -</merge> diff --git a/android/app/src/main/res/layout/settings_back_button.xml b/android/app/src/main/res/layout/settings_back_button.xml deleted file mode 100644 index 442437fca8..0000000000 --- a/android/app/src/main/res/layout/settings_back_button.xml +++ /dev/null @@ -1,12 +0,0 @@ -<merge xmlns:android="http://schemas.android.com/apk/res/android"> - <ImageView android:layout_width="24dp" - android:layout_height="24dp" - android:layout_marginEnd="8dp" - android:src="@drawable/icon_back" /> - <TextView android:id="@+id/label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/white60" - android:textSize="@dimen/text_small" - android:textStyle="bold" /> -</merge> diff --git a/android/lib/resource/src/main/res/color/switch_thumb_fill_selector.xml b/android/lib/resource/src/main/res/color/switch_thumb_fill_selector.xml deleted file mode 100644 index b294ee1038..0000000000 --- a/android/lib/resource/src/main/res/color/switch_thumb_fill_selector.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector - xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/switch_thumb_fill_checked" - android:state_checked="true" /> - <item android:color="@color/switch_thumb_fill_unchecked"/> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/account_history_entry_background.xml b/android/lib/resource/src/main/res/drawable/account_history_entry_background.xml deleted file mode 100644 index ea25d2b72a..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_history_entry_background.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <solid android:color="@color/white60" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/white40" /> - </shape> - </item> - <item android:state_focused="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/white40" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/account_history_remove.xml b/android/lib/resource/src/main/res/drawable/account_history_remove.xml deleted file mode 100644 index 6c7f52fcba..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_history_remove.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_pressed="false" - android:drawable="@drawable/account_history_remove_normal" /> - <item android:state_pressed="true" - android:drawable="@drawable/account_history_remove_pressed" /> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/account_history_remove_normal.xml b/android/lib/resource/src/main/res/drawable/account_history_remove_normal.xml deleted file mode 100644 index 532d6cd9d7..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_history_remove_normal.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="16dp" - android:height="16dp" - android:viewportWidth="24.0" - android:viewportHeight="24.0"> - <path android:fillColor="#66294D73" - android:pathData=" - M 12,24 - C 5.37312,24 0,18.62688 0,12 - C 0,5.37312 5.37312,0 12,0 - C 18.62688,0 24,5.37312 24,12 - C 24,18.62688 18.62688,24 12,24 - Z - M 13.5,12 - L 17.2947612,8.20523878 - C 17.6857559,7.81424414 17.6838785,7.18387854 17.293923,6.79392296 - L 17.206077,6.70607704 - C 16.8181114,6.31811142 16.1842538,6.31574616 15.7947612,6.70523878 - L 12,10.5 - L 8.20523878,6.70523878 - C 7.81574616,6.31574616 7.18188858,6.31811142 6.79392296,6.70607704 - L 6.70607704,6.79392296 - C 6.31612146,7.18387854 6.31424414,7.81424414 6.70523878,8.20523878 - L 10.5,12 - L 6.70523878,15.7947612 - C 6.31424414,16.1857559 6.31612146,16.8161215 6.70607704,17.206077 - L 6.79392296,17.293923 - C 7.18188858,17.6818886 7.81574616,17.6842538 8.20523878,17.2947612 - L 12,13.5 - L 15.7947612,17.2947612 - C 16.1842538,17.6842538 16.8181114,17.6818886 17.206077,17.293923 - L 17.293923,17.206077 - C 17.6838785,16.8161215 17.6857559,16.1857559 17.2947612,15.7947612 - L 13.5,12 - L13.5,12 - Z" /> -</vector> diff --git a/android/lib/resource/src/main/res/drawable/account_input_background.xml b/android/lib/resource/src/main/res/drawable/account_input_background.xml deleted file mode 100644 index d31775f404..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_input_background.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_enabled="false"> - <shape android:shape="rectangle"> - <solid android:color="@color/white20" /> - </shape> - </item> - <item android:state_enabled="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/white" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/account_login_border.xml b/android/lib/resource/src/main/res/drawable/account_login_border.xml deleted file mode 100644 index 7aa3362f35..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_border.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <solid android:color="@color/blue" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/account_login_border_error.xml b/android/lib/resource/src/main/res/drawable/account_login_border_error.xml deleted file mode 100644 index 7b0b225c85..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_border_error.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <solid android:color="@color/red" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/account_login_border_focused.xml b/android/lib/resource/src/main/res/drawable/account_login_border_focused.xml deleted file mode 100644 index fa32039e1d..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_border_focused.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <solid android:color="@color/darkBlue" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/account_login_corner.xml b/android/lib/resource/src/main/res/drawable/account_login_corner.xml deleted file mode 100644 index e4640e498d..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_corner.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="@dimen/account_login_corner_radius" - android:height="@dimen/account_login_corner_radius" - android:viewportWidth="4.0" - android:viewportHeight="4.0"> - <path android:fillColor="@color/blue" - android:pathData="M 0 4 H 2 A 2 2 0 0 1 4 2 V 0 H 0 Z" /> -</vector> diff --git a/android/lib/resource/src/main/res/drawable/account_login_corner_error.xml b/android/lib/resource/src/main/res/drawable/account_login_corner_error.xml deleted file mode 100644 index c19e1be609..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_corner_error.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="@dimen/account_login_corner_radius" - android:height="@dimen/account_login_corner_radius" - android:viewportWidth="4.0" - android:viewportHeight="4.0"> - <path android:fillColor="@color/blue" - android:pathData="M 0 4 H 1 A 3 3 0 0 1 4 1 V 0 H 0 Z" /> - <path android:fillColor="@color/red" - android:pathData="M 0 4 A 4 4 0 0 1 4 0 V 2 A 2 2 0 0 0 2 4 Z" /> -</vector> diff --git a/android/lib/resource/src/main/res/drawable/account_login_corner_focused.xml b/android/lib/resource/src/main/res/drawable/account_login_corner_focused.xml deleted file mode 100644 index a02110b51d..0000000000 --- a/android/lib/resource/src/main/res/drawable/account_login_corner_focused.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="@dimen/account_login_corner_radius" - android:height="@dimen/account_login_corner_radius" - android:viewportWidth="4.0" - android:viewportHeight="4.0"> - <path android:fillColor="@color/blue" - android:pathData="M 0 4 H 1 A 3 3 0 0 1 4 1 V 0 H 0 Z" /> - <path android:fillColor="@color/darkBlue" - android:pathData="M 0 4 A 4 4 0 0 1 4 0 V 2 A 2 2 0 0 0 2 4 Z" /> -</vector> diff --git a/android/lib/resource/src/main/res/drawable/app_list_item_background.xml b/android/lib/resource/src/main/res/drawable/app_list_item_background.xml deleted file mode 100644 index a55c1e6d01..0000000000 --- a/android/lib/resource/src/main/res/drawable/app_list_item_background.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue40" /> - </shape> - </item> - <item android:state_pressed="false" - android:state_focused="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue80" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue60" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/blue_button_background.xml b/android/lib/resource/src/main/res/drawable/blue_button_background.xml deleted file mode 100644 index e87b080bee..0000000000 --- a/android/lib/resource/src/main/res/drawable/blue_button_background.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/blue80" /> - </shape> - </item> - <item android:state_pressed="false" - android:state_focused="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/blue40" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/blue60" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/cell_button_background.xml b/android/lib/resource/src/main/res/drawable/cell_button_background.xml deleted file mode 100644 index 857a8386e1..0000000000 --- a/android/lib/resource/src/main/res/drawable/cell_button_background.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue" /> - </shape> - </item> - <item android:state_pressed="false" - android:state_focused="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue60" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/blue80" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/cell_switch_background.xml b/android/lib/resource/src/main/res/drawable/cell_switch_background.xml deleted file mode 100644 index c7b44ce746..0000000000 --- a/android/lib/resource/src/main/res/drawable/cell_switch_background.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_enabled="false"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/cell_switch_border_radius" /> - <stroke android:color="@color/white20" - android:width="2dp" /> - <size android:width="@dimen/cell_switch_width" - android:height="@dimen/cell_switch_height" /> - </shape> - </item> - <item android:state_enabled="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/cell_switch_border_radius" /> - <stroke android:color="@color/white" - android:width="2dp" /> - <size android:width="@dimen/cell_switch_width" - android:height="@dimen/cell_switch_height" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/dialog_background.xml b/android/lib/resource/src/main/res/drawable/dialog_background.xml deleted file mode 100644 index a552adc351..0000000000 --- a/android/lib/resource/src/main/res/drawable/dialog_background.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetTop="@dimen/dialog_margin" - android:insetLeft="@dimen/dialog_margin" - android:insetRight="@dimen/dialog_margin" - android:insetBottom="@dimen/dialog_margin"> - <shape android:shape="rectangle"> - <corners android:radius="11dp" /> - <solid android:color="@color/darkBlue" /> - </shape> -</inset> diff --git a/android/lib/resource/src/main/res/drawable/edit_text_background.xml b/android/lib/resource/src/main/res/drawable/edit_text_background.xml deleted file mode 100644 index 06252ac37c..0000000000 --- a/android/lib/resource/src/main/res/drawable/edit_text_background.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_enabled="false"> - <inset android:insetTop="1dp" - android:insetBottom="1dp" - android:insetLeft="1dp" - android:insetRight="1dp"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/edit_text_corner_radius" /> - <solid android:color="@color/white20" /> - </shape> - </inset> - </item> - <item android:state_enabled="true"> - <inset android:insetTop="1dp" - android:insetBottom="1dp" - android:insetLeft="1dp"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/edit_text_corner_radius" /> - <solid android:color="@color/white" /> - </shape> - </inset> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/green_button_background.xml b/android/lib/resource/src/main/res/drawable/green_button_background.xml deleted file mode 100644 index b2a50d5678..0000000000 --- a/android/lib/resource/src/main/res/drawable/green_button_background.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/green" /> - </shape> - </item> - <item android:state_pressed="false" - android:state_focused="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/green80" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/green90" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/icon_notification_error.xml b/android/lib/resource/src/main/res/drawable/icon_notification_error.xml deleted file mode 100644 index 7574392129..0000000000 --- a/android/lib/resource/src/main/res/drawable/icon_notification_error.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="oval"> - <solid android:color="@color/red" /> - <size android:width="10dp" - android:height="10dp" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/icon_notification_warning.xml b/android/lib/resource/src/main/res/drawable/icon_notification_warning.xml deleted file mode 100644 index c6baa04c1c..0000000000 --- a/android/lib/resource/src/main/res/drawable/icon_notification_warning.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="oval"> - <solid android:color="@color/yellow" /> - <size android:width="10dp" - android:height="10dp" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/input_text_background.xml b/android/lib/resource/src/main/res/drawable/input_text_background.xml deleted file mode 100644 index d4b4b3c595..0000000000 --- a/android/lib/resource/src/main/res/drawable/input_text_background.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/white" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/login_button_arrow.xml b/android/lib/resource/src/main/res/drawable/login_button_arrow.xml deleted file mode 100644 index 1909b78fe7..0000000000 --- a/android/lib/resource/src/main/res/drawable/login_button_arrow.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_enabled="false" - android:drawable="@drawable/icon_arrow_blue20" /> - <item android:state_enabled="true" - android:drawable="@drawable/icon_arrow_white" /> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/login_button_background.xml b/android/lib/resource/src/main/res/drawable/login_button_background.xml deleted file mode 100644 index c1041ef523..0000000000 --- a/android/lib/resource/src/main/res/drawable/login_button_background.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <item android:state_enabled="false"> - <shape android:shape="rectangle"> - <solid android:color="@color/white" /> - </shape> - </item> - <item android:state_enabled="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/green" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/red_button_background.xml b/android/lib/resource/src/main/res/drawable/red_button_background.xml deleted file mode 100644 index e41121638f..0000000000 --- a/android/lib/resource/src/main/res/drawable/red_button_background.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="false" - android:state_focused="false"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/red" /> - </shape> - </item> - <item android:state_pressed="false" - android:state_focused="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/red80" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <corners android:radius="4dp" /> - <solid android:color="@color/red95" /> - </shape> - </item> -</selector> diff --git a/android/lib/resource/src/main/res/drawable/switch_thumb.xml b/android/lib/resource/src/main/res/drawable/switch_thumb.xml deleted file mode 100644 index 1b32766d34..0000000000 --- a/android/lib/resource/src/main/res/drawable/switch_thumb.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:dither="true" - android:shape="oval" - android:useLevel="false" - android:visible="true"> - <size android:width="@dimen/switch_thumb_size" - android:height="@dimen/switch_thumb_size" /> - <padding android:bottom="@dimen/switch_thumb_padding" - android:left="@dimen/switch_thumb_padding" - android:right="@dimen/switch_thumb_padding" - android:top="@dimen/switch_thumb_padding" /> - <solid android:color="@color/switch_thumb_fill" /> - <stroke android:width="@dimen/switch_thumb_padding" - android:color="@color/switch_thumb_border" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/switch_track.xml b/android/lib/resource/src/main/res/drawable/switch_track.xml deleted file mode 100644 index eb287d3316..0000000000 --- a/android/lib/resource/src/main/res/drawable/switch_track.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:dither="true" - android:shape="rectangle" - android:useLevel="false" - android:visible="true"> - <size android:width="@dimen/switch_width" - android:height="@dimen/switch_height" /> - <padding android:bottom="@dimen/switch_thumb_padding" - android:left="@dimen/switch_thumb_padding" - android:right="@dimen/switch_thumb_padding" - android:top="@dimen/switch_thumb_padding" /> - <solid android:color="@color/switch_track_fill" /> - <stroke android:width="@dimen/switch_track_stroke" - android:color="@color/switch_track_border" /> - <corners android:radius="@dimen/switch_track_radius" /> -</shape> diff --git a/android/lib/resource/src/main/res/drawable/text_input_cursor.xml b/android/lib/resource/src/main/res/drawable/text_input_cursor.xml deleted file mode 100644 index 56b2895c88..0000000000 --- a/android/lib/resource/src/main/res/drawable/text_input_cursor.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="@color/darkBlue" /> - <size android:width="2sp" - android:height="24sp" /> -</shape> diff --git a/android/lib/resource/src/main/res/values/attrs.xml b/android/lib/resource/src/main/res/values/attrs.xml deleted file mode 100644 index c7e29bd8b6..0000000000 --- a/android/lib/resource/src/main/res/values/attrs.xml +++ /dev/null @@ -1,40 +0,0 @@ -<resources> - <declare-styleable name="Button"> - <attr name="buttonColor" format="enum"> - <enum name="blue" value="0" /> - <enum name="green" value="1" /> - <enum name="red" value="2" /> - </attr> - <attr name="detailImage" format="reference" /> - <attr name="showSpinner" format="boolean" /> - </declare-styleable> - <declare-styleable name="Cell"> - <attr name="footer" format="reference|string" /> - </declare-styleable> - <declare-styleable name="CopyableInformationView"> - <attr name="clipboardLabel" format="reference|string" /> - <attr name="copiedToast" format="reference|string" /> - </declare-styleable> - <declare-styleable name="InformationView"> - <attr name="description" format="reference|string" /> - <attr name="errorColor" format="reference|color" /> - <attr name="informationColor" format="reference|color" /> - <attr name="maxLength" format="integer" /> - <attr name="whenMissing" format="enum"> - <enum name="nothing" value="0" /> - <enum name="hide" value="1" /> - <enum name="showSpinner" value="2" /> - </attr> - </declare-styleable> - <declare-styleable name="TextAttribute"> - <attr name="text" format="reference|string" /> - </declare-styleable> - <declare-styleable name="Url"> - <attr name="url" format="reference|string" /> - </declare-styleable> - <declare-styleable name="UrlButton"> - <attr name="withToken" format="boolean" /> - </declare-styleable> - <attr name="actionListItemViewStyle" type="reference" /> - <attr name="applicationListItemViewStyle" type="reference" /> -</resources> diff --git a/android/lib/resource/src/main/res/values/colors.xml b/android/lib/resource/src/main/res/values/colors.xml index 1bcfd3d010..7ce616c7c0 100644 --- a/android/lib/resource/src/main/res/values/colors.xml +++ b/android/lib/resource/src/main/res/values/colors.xml @@ -1,30 +1,6 @@ <resources> <color name="colorPrimary">#294D73</color> <color name="blue">#294D73</color> - <color name="blue80">#CC294D73</color> - <color name="blue60">#99294D73</color> - <color name="blue40">#66294D73</color> - <color name="blue20">#33294D73</color> <color name="darkBlue">#192E45</color> - <color name="white">#FFFFFF</color> - <color name="white80">#CCFFFFFF</color> - <color name="white60">#99FFFFFF</color> - <color name="white40">#66FFFFFF</color> - <color name="white20">#33FFFFFF</color> - <color name="green">#44AD4D</color> - <color name="green90">#E644AD4D</color> - <color name="green80">#CC44AD4D</color> - <color name="red">#FFE34039</color> - <color name="red95">#F2E34039</color> - <color name="red80">#CCE34039</color> - <color name="red60">#99E34039</color> - <color name="yellow">#FFD323</color> <color name="icon_background">@color/darkBlue</color> - <!-- Switch Colors --> - <color name="switch_thumb_fill_checked">@color/green</color> - <color name="switch_thumb_fill_unchecked">@color/red</color> - <color name="switch_thumb_fill">@color/switch_thumb_fill_selector</color> - <color name="switch_thumb_border">@android:color/transparent</color> - <color name="switch_track_fill">@android:color/transparent</color> - <color name="switch_track_border">@color/white80</color> </resources> diff --git a/android/lib/resource/src/main/res/values/dimensions.xml b/android/lib/resource/src/main/res/values/dimensions.xml index b4e09ab70a..a499351d77 100644 --- a/android/lib/resource/src/main/res/values/dimensions.xml +++ b/android/lib/resource/src/main/res/values/dimensions.xml @@ -1,51 +1,7 @@ <resources> - <dimen name="dialog_margin">14dp</dimen> - <dimen name="account_login_input_height">48dp</dimen> - <dimen name="account_login_corner_radius">4dp</dimen> - <dimen name="account_login_border_width">2dp</dimen> - <dimen name="account_history_divider">1dp</dimen> - <dimen name="account_history_entry_height">48dp</dimen> - <dimen name="edit_text_corner_radius">4dp</dimen> - <dimen name="button_height">44dp</dimen> - <dimen name="cell_height">52dp</dimen> - <dimen name="cell_switch_border_radius">16dp</dimen> - <dimen name="cell_switch_width">48dp</dimen> - <dimen name="cell_switch_height">30dp</dimen> - <dimen name="cell_switch_knob_margin">4dp</dimen> - <dimen name="cell_switch_knob_max_translation">18dp</dimen> - <dimen name="cell_switch_knob_size">22dp</dimen> - <dimen name="settings_back_button_padding">12dp</dimen> - <dimen name="cell_left_padding">@dimen/side_margin</dimen> - <dimen name="cell_right_padding">16dp</dimen> - <dimen name="cell_inner_spacing">8dp</dimen> - <dimen name="cell_label_vertical_padding">14dp</dimen> - <dimen name="cell_footer_top_padding">6dp</dimen> - <dimen name="cell_footer_horizontal_padding">@dimen/side_margin</dimen> <dimen name="text_small">13sp</dimen> <dimen name="text_medium">16sp</dimen> <dimen name="text_medium_plus">18sp</dimen> <dimen name="text_big">24sp</dimen> - <dimen name="text_huge">30sp</dimen> - <dimen name="side_margin">22dp</dimen> - <dimen name="vertical_space">20dp</dimen> - <dimen name="half_vertical_space">10dp</dimen> - <dimen name="button_separation">18dp</dimen> - <dimen name="screen_vertical_margin">22dp</dimen> - <dimen name="progress_size">60dp</dimen> - <dimen name="icon_size">24dp</dimen> - <dimen name="widget_padding">16dp</dimen> - <dimen name="expanded_toolbar_height">104dp</dimen> - <dimen name="information_icon_size">28dp</dimen> - <dimen name="information_action_margin">20dp</dimen> - <dimen name="medium_padding">16dp</dimen> - <dimen name="small_padding">8dp</dimen> <dimen name="zero_size">0px</dimen> - <!-- Switch Dimens--> - <dimen name="switch_width">46dp</dimen> - <dimen name="switch_height">30dp</dimen> - <dimen name="switch_thumb_size">30dp</dimen> - <dimen name="switch_thumb_padding">8dp</dimen> - <dimen name="switch_track_radius">16dp</dimen> - <dimen name="switch_track_stroke">2dp</dimen> - <dimen name="top_bar_height">64dp</dimen> </resources> diff --git a/android/lib/resource/src/main/res/values/styles.xml b/android/lib/resource/src/main/res/values/styles.xml index e03dd86700..69ee118cac 100644 --- a/android/lib/resource/src/main/res/values/styles.xml +++ b/android/lib/resource/src/main/res/values/styles.xml @@ -4,92 +4,7 @@ <item name="android:navigationBarColor">@color/blue</item> <item name="android:statusBarColor">@color/blue</item> <item name="android:windowBackground">@color/blue</item> - <item name="switchStyle">@style/AppTheme.Switch</item> - <item name="actionListItemViewStyle">@style/ListItem.Action</item> - <item name="applicationListItemViewStyle">@style/ListItem.Action.Application</item> <item name="android:spotShadowAlpha">0</item> <item name="actionBarSize">48dp</item> </style> - <style name="InputText" parent="Widget.AppCompat.EditText"> - <item name="android:padding">14dp</item> - <item name="android:background">@drawable/input_text_background</item> - <item name="android:textCursorDrawable">@drawable/text_input_cursor</item> - <item name="android:textColorHint">@color/blue40</item> - <item name="android:textColor">@color/blue</item> - <item name="android:textSize">@dimen/text_small</item> - </style> - <style name="Button" parent="Widget.AppCompat.Button.Borderless"> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_width">match_parent</item> - <item name="android:minHeight">@dimen/button_height</item> - <item name="android:paddingTop">0dp</item> - <item name="android:paddingBottom">0dp</item> - <item name="android:textAllCaps">false</item> - <item name="android:textColor">@color/white</item> - <item name="android:textSize">@dimen/text_medium_plus</item> - <item name="android:textStyle">bold</item> - </style> - <style name="GreenButton" parent="Button"> - <item name="android:background">@drawable/green_button_background</item> - </style> - <style name="RedButton" parent="Button"> - <item name="android:background">@drawable/red_button_background</item> - </style> - <style name="BlueButton" parent="Button"> - <item name="android:background">@drawable/blue_button_background</item> - </style> - <style name="SettingsHeader"> - <item name="android:textColor">@color/white</item> - <item name="android:textStyle">bold</item> - </style> - <style name="SettingsExpandedHeader" parent="SettingsHeader"> - <item name="android:textSize">@dimen/text_huge</item> - </style> - <style name="SettingsCollapsedHeader" parent="SettingsHeader"> - <item name="android:textSize">@dimen/text_medium</item> - </style> - <style name="TextAppearance.Mullvad" parent="TextAppearance.AppCompat" /> - <style name="TextAppearance.Mullvad.Title1"> - <item name="android:textColor">@color/white</item> - <item name="android:textSize">@dimen/text_medium_plus</item> - </style> - <style name="TextAppearance.Mullvad.Small"> - <item name="android:textColor">@color/white60</item> - <item name="android:textSize">@dimen/text_small</item> - </style> - <style name="ListItem"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - </style> - <style name="ListItem.DividerGroup"> - <item name="android:layout_height">@dimen/vertical_space</item> - </style> - <style name="ListItem.PlainText"> - <item name="android:focusable">false</item> - <item name="android:clickable">false</item> - <item name="android:paddingTop">5dp</item> - </style> - <style name="ListItem.Action"> - <item name="android:height">@dimen/cell_height</item> - <item name="android:layout_height">@dimen/cell_height</item> - <item name="android:background">@drawable/cell_button_background</item> - <item name="android:clickable">true</item> - <item name="android:focusable">true</item> - </style> - <style name="ListItem.Action.Application"> - <item name="android:background">@drawable/app_list_item_background</item> - </style> - <style name="ListItem.Action.Double"> - <item name="android:clickable">false</item> - <item name="android:focusable">false</item> - </style> - <!-- Switch Style --> - <style name="AppTheme.Switch"> - <item name="android:layout_width">@dimen/switch_width</item> - <item name="android:layout_height">@dimen/switch_height</item> - <item name="track">@drawable/switch_track</item> - <item name="android:thumb">@drawable/switch_thumb</item> - <item name="switchMinWidth">@dimen/switch_width</item> - <item name="showText">false</item> - </style> </resources> |
