Variable names

This commit is contained in:
Moez Bhatti
2015-09-02 00:34:25 -04:00
parent fb4a6ae436
commit c43ab1b1b4
3 changed files with 65 additions and 65 deletions
@@ -152,9 +152,9 @@ public class Message {
} }
public boolean isVisible() { public boolean isVisible() {
return getThreadId() == MainActivity.threadId && return getThreadId() == MainActivity.sThreadId &&
MainActivity.isShowing && MainActivity.sIsShowing &&
!MainActivity.isContentHidden; !MainActivity.sIsContentHidden;
} }
public void markSeen() { public void markSeen() {
@@ -53,8 +53,8 @@ public class NotificationService extends Service {
if (conversationPrefs.getNotificationsEnabled()) { if (conversationPrefs.getNotificationsEnabled()) {
// Only show QuickReply if we're outside of the app, and they have popups and // Only show QuickReply if we're outside of the app, and they have popups and
// QuickReply enabled. // QuickReply enabled.
if (!QKReplyActivity.sIsShowing && !MainActivity.isShowing && intent.getBooleanExtra(EXTRA_POPUP, false) && if (!QKReplyActivity.sIsShowing && !MainActivity.sIsShowing && intent.getBooleanExtra(EXTRA_POPUP, false) &&
prefs.getBoolean(SettingsFragment.QUICKREPLY, true) && !MainActivity.isShowing) { prefs.getBoolean(SettingsFragment.QUICKREPLY, true) && !MainActivity.sIsShowing) {
popupIntent = new Intent(context, QKReplyActivity.class); popupIntent = new Intent(context, QKReplyActivity.class);
popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -84,16 +84,16 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain"; public static final String MMS_SETUP_DONT_ASK_AGAIN = "mmsSetupDontAskAgain";
// thread IDs are always nonnegative // thread IDs are always nonnegative
public static long threadId = 0; public static long sThreadId = 0;
public static boolean isShowing = false; public static boolean sIsShowing = false;
public static boolean isContentHidden = true; public static boolean sIsContentHidden = true;
private static Resources res; private static Resources sRes;
private static SharedPreferences prefs; private static SharedPreferences sPrefs;
private SlidingMenu mSlidingMenu; private SlidingMenu mSlidingMenu;
private ConversationListFragment menuFragment; private ConversationListFragment mConversationList;
private Fragment content; private Fragment mContent;
private long mWaitingForThreadId = -1; private long mWaitingForThreadId = -1;
private boolean mIsDestroyed = false; private boolean mIsDestroyed = false;
@@ -130,39 +130,39 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
private void setupFragments(Bundle savedInstanceState) { private void setupFragments(Bundle savedInstanceState) {
int type = 0; int type = 0;
int position = 0; int position = 0;
threadId = 0; sThreadId = 0;
if (savedInstanceState != null) { if (savedInstanceState != null) {
type = savedInstanceState.getInt(KEY_TYPE, 0); type = savedInstanceState.getInt(KEY_TYPE, 0);
position = savedInstanceState.getInt(KEY_POSITION, 0); position = savedInstanceState.getInt(KEY_POSITION, 0);
threadId = savedInstanceState.getLong(KEY_THREADID, 0); sThreadId = savedInstanceState.getLong(KEY_THREADID, 0);
} }
menuFragment = new ConversationListFragment(); mConversationList = new ConversationListFragment();
menuFragment.setPosition(position); mConversationList.setPosition(position);
getFragmentManager().beginTransaction() getFragmentManager().beginTransaction()
.replace(R.id.menu_frame, menuFragment) .replace(R.id.menu_frame, mConversationList)
.commit(); .commit();
switch (type) { switch (type) {
case TYPE_COMPOSE: case TYPE_COMPOSE:
content = new ComposeFragment(); mContent = new ComposeFragment();
break; break;
case TYPE_CONVERSATION: case TYPE_CONVERSATION:
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong(MessageListFragment.ARG_THREAD_ID, threadId); args.putLong(MessageListFragment.ARG_THREAD_ID, sThreadId);
content = MessageListFragment.getInstance(args); mContent = MessageListFragment.getInstance(args);
break; break;
case TYPE_SETTINGS: case TYPE_SETTINGS:
content = SettingsFragment.newInstance(R.xml.settings_simple); mContent = SettingsFragment.newInstance(R.xml.settings_simple);
break; break;
case TYPE_SEARCH: case TYPE_SEARCH:
content = new SearchFragment(); mContent = new SearchFragment();
break; break;
} }
getFragmentManager().beginTransaction() getFragmentManager().beginTransaction()
.replace(R.id.content_frame, content) .replace(R.id.content_frame, mContent)
.commit(); .commit();
} }
@@ -208,7 +208,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
} }
private void launchWelcomeActivity() { private void launchWelcomeActivity() {
if (prefs.getBoolean(SettingsFragment.WELCOME_SEEN, false)) { if (sPrefs.getBoolean(SettingsFragment.WELCOME_SEEN, false)) {
// User has already seen the welcome screen // User has already seen the welcome screen
return; return;
} }
@@ -226,7 +226,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
} }
private void setupSlidingMenu() { private void setupSlidingMenu() {
setSlidingTabEnabled(prefs.getBoolean(SettingsFragment.SLIDING_TAB, false)); setSlidingTabEnabled(sPrefs.getBoolean(SettingsFragment.SLIDING_TAB, false));
mSlidingMenu.setBehindScrollScale(0.5f); mSlidingMenu.setBehindScrollScale(0.5f);
mSlidingMenu.setFadeDegree(0.5f); mSlidingMenu.setFadeDegree(0.5f);
mSlidingMenu.setOnOpenListener(this); mSlidingMenu.setOnOpenListener(this);
@@ -260,7 +260,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater(); MenuInflater inflater = getMenuInflater();
if (mSlidingMenu.isMenuShowing() || content == null) { if (mSlidingMenu.isMenuShowing() || mContent == null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(false);
setTitle(getString(R.string.title_conversation_list)); setTitle(getString(R.string.title_conversation_list));
@@ -269,25 +269,25 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
} else { } else {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (content instanceof MessageListFragment) { if (mContent instanceof MessageListFragment) {
inflater.inflate(R.menu.conversation, menu); inflater.inflate(R.menu.conversation, menu);
((MessageListFragment) content).setTitle(); ((MessageListFragment) mContent).setTitle();
} else if (content instanceof SearchFragment) { } else if (mContent instanceof SearchFragment) {
setTitle(getString(R.string.title_search)); setTitle(getString(R.string.title_search));
inflater.inflate(R.menu.search, menu); inflater.inflate(R.menu.search, menu);
} else if (content instanceof SettingsFragment) { } else if (mContent instanceof SettingsFragment) {
setTitle(getString(R.string.title_settings)); setTitle(getString(R.string.title_settings));
inflater.inflate(R.menu.settings, menu); inflater.inflate(R.menu.settings, menu);
MenuItem simplePrefs = menu.findItem(R.id.simple_settings); MenuItem simplePrefs = menu.findItem(R.id.simple_settings);
if (prefs.getBoolean(SettingsFragment.SIMPLE_PREFS, true)) { if (sPrefs.getBoolean(SettingsFragment.SIMPLE_PREFS, true)) {
simplePrefs.setTitle(R.string.menu_show_all_prefs); simplePrefs.setTitle(R.string.menu_show_all_prefs);
} else { } else {
simplePrefs.setTitle(R.string.menu_show_fewer_prefs); simplePrefs.setTitle(R.string.menu_show_fewer_prefs);
} }
} else if (content instanceof ComposeFragment) { } else if (mContent instanceof ComposeFragment) {
setTitle(getString(R.string.title_compose)); setTitle(getString(R.string.title_compose));
inflater.inflate(R.menu.compose, menu); inflater.inflate(R.menu.compose, menu);
} }
@@ -296,16 +296,16 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
public Fragment getMenuFragment() { public Fragment getConversationList() {
return menuFragment; return mConversationList;
} }
public Fragment getContent() { public Fragment getContent() {
return content; return mContent;
} }
public long getThreadId() { public long getThreadId() {
return threadId; return sThreadId;
} }
@Override @Override
@@ -315,8 +315,8 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
onKeyUp(KeyEvent.KEYCODE_BACK, null); onKeyUp(KeyEvent.KEYCODE_BACK, null);
break; break;
case R.id.simple_settings: case R.id.simple_settings:
prefs.edit().putBoolean(SettingsFragment.SIMPLE_PREFS, sPrefs.edit().putBoolean(SettingsFragment.SIMPLE_PREFS,
!prefs.getBoolean(SettingsFragment.SIMPLE_PREFS, true)).apply(); !sPrefs.getBoolean(SettingsFragment.SIMPLE_PREFS, true)).apply();
case R.id.menu_settings: case R.id.menu_settings:
switchContent(SettingsFragment.newInstance(R.xml.settings_simple), true); switchContent(SettingsFragment.newInstance(R.xml.settings_simple), true);
break; break;
@@ -410,9 +410,9 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
isShowing = false; sIsShowing = false;
if (!mSlidingMenu.isMenuShowing()) { if (!mSlidingMenu.isMenuShowing()) {
QKContentFragment.notifyOnContentClosed(content); QKContentFragment.notifyOnContentClosed(mContent);
} }
} }
@@ -432,11 +432,11 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
isShowing = true; sIsShowing = true;
ThemeManager.loadThemeProperties(this); ThemeManager.loadThemeProperties(this);
if (!mSlidingMenu.isMenuShowing()) { if (!mSlidingMenu.isMenuShowing()) {
QKContentFragment.notifyOnContentOpened(content); QKContentFragment.notifyOnContentOpened(mContent);
} }
NotificationManager.initQuickCompose(this, false, false); NotificationManager.initQuickCompose(this, false, false);
@@ -496,10 +496,10 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
} }
private void beginMmsSetup() { private void beginMmsSetup() {
if (!prefs.getBoolean(MMS_SETUP_DONT_ASK_AGAIN, false) && if (!sPrefs.getBoolean(MMS_SETUP_DONT_ASK_AGAIN, false) &&
TextUtils.isEmpty(prefs.getString(SettingsFragment.MMSC_URL, "")) && TextUtils.isEmpty(sPrefs.getString(SettingsFragment.MMSC_URL, "")) &&
TextUtils.isEmpty(prefs.getString(SettingsFragment.MMS_PROXY, "")) && TextUtils.isEmpty(sPrefs.getString(SettingsFragment.MMS_PROXY, "")) &&
TextUtils.isEmpty(prefs.getString(SettingsFragment.MMS_PORT, ""))) { TextUtils.isEmpty(sPrefs.getString(SettingsFragment.MMS_PORT, ""))) {
// Launch the MMS setup fragment here. This is a series of dialogs that will guide the // Launch the MMS setup fragment here. This is a series of dialogs that will guide the
// user through the MMS setup process. // user through the MMS setup process.
@@ -529,11 +529,11 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
outState.putBoolean(KEY_MMS_SETUP_FRAGMENT_DISMISSED, true); outState.putBoolean(KEY_MMS_SETUP_FRAGMENT_DISMISSED, true);
} }
outState.putInt(KEY_TYPE, content instanceof MessageListFragment ? TYPE_CONVERSATION : outState.putInt(KEY_TYPE, mContent instanceof MessageListFragment ? TYPE_CONVERSATION :
content instanceof SettingsFragment ? TYPE_SETTINGS : mContent instanceof SettingsFragment ? TYPE_SETTINGS :
content instanceof SearchFragment ? TYPE_SEARCH : TYPE_COMPOSE); mContent instanceof SearchFragment ? TYPE_SEARCH : TYPE_COMPOSE);
outState.putInt(KEY_POSITION, menuFragment.getPosition()); outState.putInt(KEY_POSITION, mConversationList.getPosition());
outState.putLong(KEY_THREADID, threadId); outState.putLong(KEY_THREADID, sThreadId);
} }
public void switchContent(Fragment fragment, boolean animate) { public void switchContent(Fragment fragment, boolean animate) {
@@ -541,7 +541,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
if (fragment != null && !mIsDestroyed) { if (fragment != null && !mIsDestroyed) {
KeyboardUtils.hide(this); KeyboardUtils.hide(this);
content = fragment; mContent = fragment;
FragmentManager m = getFragmentManager(); FragmentManager m = getFragmentManager();
// Only do a replace if it is a different fragment. // Only do a replace if it is a different fragment.
@@ -584,18 +584,18 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
MessageListFragment fragment = MessageListFragment.getInstance(args); MessageListFragment fragment = MessageListFragment.getInstance(args);
// Save the thread ID here and switch the content // Save the thread ID here and switch the content
MainActivity.threadId = threadId; MainActivity.sThreadId = threadId;
switchContent(fragment, animate); switchContent(fragment, animate);
} }
@Override @Override
public void onOpen() { public void onOpen() {
invalidateOptionsMenu(); invalidateOptionsMenu();
isContentHidden = true; sIsContentHidden = true;
// Notify the content that it is being closed, since the menu (i.e. conversation list) is // Notify the content that it is being closed, since the menu (i.e. conversation list) is
// being opened. // being opened.
QKContentFragment.notifyOnContentClosing(content); QKContentFragment.notifyOnContentClosing(mContent);
// Hide the soft keyboard // Hide the soft keyboard
KeyboardUtils.hide(this, getCurrentFocus()); KeyboardUtils.hide(this, getCurrentFocus());
@@ -610,11 +610,11 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
@Override @Override
public void onClose() { public void onClose() {
invalidateOptionsMenu(); invalidateOptionsMenu();
isContentHidden = false; sIsContentHidden = false;
// Notify the content that it is being opened, since the menu (i.e. conversation list) is // Notify the content that it is being opened, since the menu (i.e. conversation list) is
// being closed. // being closed.
QKContentFragment.notifyOnContentOpening(content); QKContentFragment.notifyOnContentOpening(mContent);
// Hide the soft keyboard // Hide the soft keyboard
KeyboardUtils.hide(this, getCurrentFocus()); KeyboardUtils.hide(this, getCurrentFocus());
@@ -626,14 +626,14 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
public void onOpened() { public void onOpened() {
// When the menu (i.e. the conversation list) has been opened, the content has been opened. // When the menu (i.e. the conversation list) has been opened, the content has been opened.
// So notify the content fragment. // So notify the content fragment.
QKContentFragment.notifyOnContentClosed(content); QKContentFragment.notifyOnContentClosed(mContent);
} }
@Override @Override
public void onClosed() { public void onClosed() {
// When the menu (i.e. the conversation list) has been closed, the content has been opened. // When the menu (i.e. the conversation list) has been closed, the content has been opened.
// So notify the content fragment. // So notify the content fragment.
QKContentFragment.notifyOnContentOpened(content); QKContentFragment.notifyOnContentOpened(mContent);
} }
/** /**
@@ -683,17 +683,17 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
} }
public static SharedPreferences getPrefs(Context context) { public static SharedPreferences getPrefs(Context context) {
if (prefs == null) { if (sPrefs == null) {
prefs = PreferenceManager.getDefaultSharedPreferences(context); sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
} }
return prefs; return sPrefs;
} }
public static Resources getRes(Context context) { public static Resources getRes(Context context) {
if (res == null) { if (sRes == null) {
res = context.getResources(); sRes = context.getResources();
} }
return res; return sRes;
} }
public static class DeleteThreadListener implements DialogInterface.OnClickListener { public static class DeleteThreadListener implements DialogInterface.OnClickListener {