Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 4824e9f

Browse files
Sam1301kunall17
authored andcommitted
Minor refactoring changes
Seperate out constants from util and use javadoc comments.
1 parent 04d0e04 commit 4824e9f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140
import retrofit2.Call;
141141
import retrofit2.Response;
142142

143+
import static com.zulip.android.util.Constants.REQUEST_PICK_FILE;
144+
143145
/**
144146
* The main Activity responsible for holding the {@link MessageListFragment} which has the list to the
145147
* messages
@@ -157,8 +159,6 @@ public class ZulipActivity extends BaseActivity implements
157159
private static final int PERMISSION_REQUEST_READ_STORAGE = 1;
158160
private static final int REQUEST_TAKE_PHOTO = 2;
159161
private static final Interpolator FAST_OUT_SLOW_IN_INTERPOLATOR = new FastOutSlowInInterpolator();
160-
private static final int HIDE_FAB_AFTER_SEC = 5;
161-
private static final int REQUEST_PICK_FILE = 3;
162162
// row number which is used to differentiate the 'All private messages'
163163
// row from the people
164164
final int allPeopleId = -1;
@@ -570,9 +570,11 @@ public void showListDialog() {
570570
dialog.show(getFragmentManager(), "ListDialogFragment");
571571
}
572572

573-
// The dialog fragment receives a reference to this Activity through the
574-
// Fragment.onAttach() callback, which it uses to call the following methods
575-
// defined by the ListDialogFragment.ListDialogListener interface
573+
/**
574+
* The dialog fragment receives a reference to this Activity through the
575+
* Fragment.onAttach() callback, which it uses to call the following methods
576+
* defined by the ListDialogFragment.ListDialogListener interface.
577+
*/
576578
@Override
577579
public void onDialogPhotoClick(DialogFragment dialog) {
578580
// User touched the dialog's "Take picture" button
@@ -946,6 +948,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
946948
if (data.getData() != null) {
947949
fileUris.add(data.getData());
948950
}
951+
// intent.getClipData was added in api 16
949952
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
950953
ClipData clipData = data.getClipData();
951954
if (clipData != null) {
@@ -1309,7 +1312,7 @@ private void setupFab() {
13091312
fab = (FloatingActionButton) findViewById(R.id.fab);
13101313
chatBox = (SwipeRemoveLinearLayout) findViewById(R.id.messageBoxContainer);
13111314
chatBox.registerToSwipeEvents(this);
1312-
fabHidder = new CountDownTimer(HIDE_FAB_AFTER_SEC * 1000, HIDE_FAB_AFTER_SEC * 1000) {
1315+
fabHidder = new CountDownTimer(Constants.HIDE_FAB_AFTER_SEC * 1000, Constants.HIDE_FAB_AFTER_SEC * 1000) {
13131316
public void onTick(long millisUntilFinished) {
13141317
}
13151318

@@ -2368,7 +2371,7 @@ private void dispatchPickIntent() {
23682371
}
23692372

23702373
if (intent.resolveActivity(getPackageManager()) != null) {
2371-
startActivityForResult(intent, REQUEST_PICK_FILE);
2374+
startActivityForResult(intent, Constants.REQUEST_PICK_FILE);
23722375
// activity transition animation
23732376
ActivityTransitionAnim.transition(ZulipActivity.this);
23742377
}

app/src/main/java/com/zulip/android/util/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class Constants {
1414
public final static String SERVER_URL = "SERVER_URL";
1515
public static int MILLISECONDS_IN_A_MINUTE = 1000;
1616
public static String DATE_FORMAT = "dd/MM/yyyy";
17+
public static final int HIDE_FAB_AFTER_SEC = 5;
18+
public static final int REQUEST_PICK_FILE = 3;
1719

1820
public static final long STATUS_UPDATER_INTERVAL = 25 * 1000; //in milliseconds
1921
public static final int INACTIVE_TIME_OUT = 2 * 60; //in milliseconds

0 commit comments

Comments
 (0)