From 30cf213e564bfd6f2f136e9f77ad81130e959c07 Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Sun, 28 Feb 2016 01:34:10 -0500 Subject: [PATCH] Reduce GPU overdraw --- .../main/java/com/moez/QKSMS/ui/MainActivity.java | 13 +++++++------ QKSMS/src/main/res/layout/activity_main.xml | 4 ++-- QKSMS/src/main/res/layout/content_frame.xml | 7 +++---- QKSMS/src/main/res/layout/fragment_conversation.xml | 1 - QKSMS/src/main/res/layout/menu_frame.xml | 7 +++---- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java index 69f1fce9..d87e5184 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java @@ -25,6 +25,8 @@ import android.view.MenuItem; import android.view.View; import android.widget.CheckBox; import android.widget.ImageView; +import butterknife.Bind; +import butterknife.ButterKnife; import com.google.android.mms.pdu_alt.PduHeaders; import com.moez.QKSMS.R; import com.moez.QKSMS.common.ConversationPrefsHelper; @@ -63,7 +65,6 @@ import java.util.Collection; public class MainActivity extends QKActivity implements SlidingMenu.SlidingMenuListener { - private final String TAG = "MainActivity"; public final static String EXTRA_THREAD_ID = "thread_id"; @@ -78,7 +79,9 @@ public class MainActivity extends QKActivity implements SlidingMenu.SlidingMenuL public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain"; - private SlidingMenu mSlidingMenu; + @Bind(R.id.root) View mRoot; + @Bind(R.id.sliding_menu) SlidingMenu mSlidingMenu; + private ConversationListFragment mConversationList; private ContentFragment mContent; private long mWaitingForThreadId = -1; @@ -97,8 +100,8 @@ public class MainActivity extends QKActivity implements SlidingMenu.SlidingMenuL setContentView(R.layout.activity_main); setTitle(R.string.title_conversation_list); + ButterKnife.bind(this); - mSlidingMenu = (SlidingMenu) findViewById(R.id.sliding_menu); setSlidingTabEnabled(mPrefs.getBoolean(SettingsFragment.SLIDING_TAB, false)); mSlidingMenu.setListener(this); mSlidingMenu.setContent(); @@ -131,9 +134,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.SlidingMenuL LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> { // Update the background color. This code is important during the welcome screen setup, when the activity // in the ThemeManager isn't the MainActivity - findViewById(R.id.menu_frame).getRootView().setBackgroundColor(ThemeManager.getBackgroundColor()); - findViewById(R.id.menu_frame).setBackgroundColor(ThemeManager.getBackgroundColor()); - findViewById(R.id.content_frame).setBackgroundColor(ThemeManager.getBackgroundColor()); + mRoot.setBackgroundColor(ThemeManager.getBackgroundColor()); }); //Adds a small/non intrusive snackbar that asks the user to rate the app diff --git a/QKSMS/src/main/res/layout/activity_main.xml b/QKSMS/src/main/res/layout/activity_main.xml index f6a2c7b7..c14961bb 100644 --- a/QKSMS/src/main/res/layout/activity_main.xml +++ b/QKSMS/src/main/res/layout/activity_main.xml @@ -1,8 +1,8 @@ - diff --git a/QKSMS/src/main/res/layout/content_frame.xml b/QKSMS/src/main/res/layout/content_frame.xml index ddd71648..08f5fba6 100644 --- a/QKSMS/src/main/res/layout/content_frame.xml +++ b/QKSMS/src/main/res/layout/content_frame.xml @@ -1,6 +1,5 @@ - \ No newline at end of file + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/QKSMS/src/main/res/layout/fragment_conversation.xml b/QKSMS/src/main/res/layout/fragment_conversation.xml index aa99dbc0..61a15b6e 100644 --- a/QKSMS/src/main/res/layout/fragment_conversation.xml +++ b/QKSMS/src/main/res/layout/fragment_conversation.xml @@ -3,7 +3,6 @@ - \ No newline at end of file + android:layout_height="match_parent" /> \ No newline at end of file