-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MM-34585 Use removeClippedSubviews from Lists to improve scroll perf #5199
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6ad405e
android: Set the app to run at the highest available fps
enahum 28d7d1c
Trigger Android & iOS independent Pr builds
enahum 6b6e7da
Force Android to run at 60fps
enahum 82a82db
Merge branch 'master' into fps
enahum f1c97ad
Use removeClippedSubviews from Lists to improve scroll perf
enahum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
package com.mattermost.rnbeta; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import androidx.annotation.Nullable; | ||
|
||
import android.view.Display; | ||
import android.view.KeyEvent; | ||
import android.content.res.Configuration; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
|
||
import com.reactnativenavigation.NavigationActivity; | ||
import com.github.emilioicai.hwkeyboardevent.HWKeyboardEventModule; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Optional; | ||
|
||
public class MainActivity extends NavigationActivity { | ||
private boolean HWKeyboardConnected = false; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setFrameRate(); | ||
setContentView(R.layout.launch_screen); | ||
setHWKeyboardConnected(); | ||
} | ||
|
@@ -47,4 +58,49 @@ public boolean dispatchKeyEvent(KeyEvent event) { | |
private void setHWKeyboardConnected() { | ||
HWKeyboardConnected = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; | ||
} | ||
|
||
protected void setFrameRate() { | ||
ArrayList<HashMap<String, Object>> supported = getSupportedModes(); | ||
boolean seen = false; | ||
HashMap<String, Object> best = null; | ||
for (HashMap<String, Object> stringObjectHashMap : supported) { | ||
Float refreshRate = (Float)stringObjectHashMap.getOrDefault("refreshRate", 0f); | ||
if (!seen || Math.round(refreshRate) == 60) { | ||
seen = true; | ||
best = stringObjectHashMap; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just break out of the for loop after setting best. |
||
} | ||
} | ||
|
||
if (best != null && best.get("id") != null) { | ||
final Window window = this.getWindow(); | ||
final WindowManager.LayoutParams params = window.getAttributes(); | ||
params.preferredDisplayModeId =(int)best.get("id"); | ||
window.setAttributes(params); | ||
} | ||
} | ||
|
||
protected ArrayList<HashMap<String, Object>> getSupportedModes() { | ||
final ArrayList<HashMap<String, Object>> ret = new ArrayList<>(); | ||
final WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); | ||
final Display display = windowManager.getDefaultDisplay(); | ||
final Display.Mode[] modes = display.getSupportedModes(); | ||
if (modes == null) { | ||
return ret; | ||
} | ||
|
||
final Window window = this.getWindow(); | ||
final WindowManager.LayoutParams params = window.getAttributes(); | ||
final int selectedMode = params.preferredDisplayModeId; | ||
|
||
for (final Display.Mode mode : modes) { | ||
final HashMap<String, Object> item = new HashMap<>(); | ||
item.put("id", mode.getModeId()); | ||
item.put("width", mode.getPhysicalWidth()); | ||
migbot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
item.put("height", mode.getPhysicalHeight()); | ||
item.put("refreshRate", mode.getRefreshRate()); | ||
item.put("selected", mode.getModeId() == selectedMode); | ||
ret.add(item); | ||
} | ||
return ret; | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this PR be reverted at some point? If so, consider having these changes in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep this, that way if a PR fails for a particular platform we can just build the platform that we need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea, I meant that this specific change can be in a separate PR if you foresee the FPS changes being reverted in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe ;)