This repository has been archived by the owner on Jan 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uplift of "What's new" feature. (#1201)
- Loading branch information
Showing
27 changed files
with
566 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.focus.ext | ||
|
||
import android.content.Context | ||
|
||
// Extension functions for the Context class | ||
|
||
/** | ||
* The (visible) version name of the application, as specified by the <manifest> tag's versionName | ||
* attribute. E.g. "2.0". | ||
*/ | ||
val Context.appVersionName: String? | ||
get() { | ||
val packageInfo = packageManager.getPackageInfo(packageName, 0) | ||
return packageInfo.versionName | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...cus/menu/CustomTabMenuItemViewHolder.java → .../browser/CustomTabMenuItemViewHolder.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.focus.menu.home | ||
|
||
import android.content.Context | ||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import android.support.v7.widget.LinearLayoutManager | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.PopupWindow | ||
import kotlinx.android.synthetic.main.menu.view.* | ||
import org.mozilla.focus.R | ||
import org.mozilla.focus.utils.ViewUtils | ||
|
||
/** | ||
* The overflow menu shown on the start/home screen. | ||
*/ | ||
class HomeMenu( | ||
val context: Context, | ||
val listener: View.OnClickListener | ||
) : PopupWindow(), View.OnClickListener { | ||
init { | ||
contentView = LayoutInflater.from(context).inflate(R.layout.menu, null) | ||
|
||
with(contentView.list) { | ||
layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) | ||
adapter = HomeMenuAdapter(context, this@HomeMenu) | ||
} | ||
|
||
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | ||
|
||
isFocusable = true | ||
|
||
height = ViewGroup.LayoutParams.WRAP_CONTENT | ||
width = ViewGroup.LayoutParams.WRAP_CONTENT | ||
|
||
elevation = context.resources.getDimension(R.dimen.menu_elevation) | ||
} | ||
|
||
fun show(anchor: View) { | ||
val xOffset = if (ViewUtils.isRTL(anchor)) -anchor.width else 0 | ||
|
||
super.showAsDropDown(anchor, xOffset, -(anchor.height + anchor.paddingBottom)) | ||
} | ||
|
||
override fun onClick(view: View?) { | ||
dismiss() | ||
|
||
listener.onClick(view) | ||
} | ||
} |
Oops, something went wrong.