Skip to content

Commit 7421da5

Browse files
reformat code
1 parent 6927b55 commit 7421da5

File tree

4 files changed

+21
-24
lines changed

4 files changed

+21
-24
lines changed

app/src/main/java/in/tosc/studddin/fragments/ListingsFragment.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.os.Bundle;
1010
import android.provider.MediaStore;
1111
import android.support.v4.app.Fragment;
12-
import android.support.v4.app.FragmentManager;
1312
import android.support.v4.app.FragmentStatePagerAdapter;
1413
import android.support.v4.view.ViewPager;
1514
import android.support.v7.app.ActionBarActivity;
@@ -61,7 +60,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
6160
fragmentPagerAdapter = new FragmentStatePagerAdapter(getChildFragmentManager()) {
6261
@Override
6362
public Fragment getItem(int position) {
64-
Log.d(TAG,"getItem called");
63+
Log.d(TAG, "getItem called");
6564
switch (position) {
6665
case 0:
6766
return new ListingsSearchFragment();
@@ -95,11 +94,9 @@ public CharSequence getPageTitle(int position) {
9594
listingsPager = (ViewPager) rootView.findViewById(R.id.listings_pager);
9695

9796

98-
99-
10097
try {
10198
listingsPager.setAdapter(fragmentPagerAdapter);
102-
listingsPager.setOffscreenPageLimit(2);
99+
listingsPager.setOffscreenPageLimit(2);
103100
tabs = (SlidingTabLayout) rootView.findViewById(R.id.tabs);
104101
tabs.setDistributeEvenly(true);
105102
tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
@@ -124,7 +121,8 @@ public void goToOtherFragment(int position) {
124121
@Override
125122
public void onActivityResult(int requestCode, int resultCode, Intent data) {
126123
super.onActivityResult(requestCode, resultCode, data);
127-
if (DEBUG) Log.d(TAG, "onActivityResult call ho raha hai" + resultCode + " " + requestCode);
124+
if (DEBUG)
125+
Log.d(TAG, "onActivityResult call ho raha hai" + resultCode + " " + requestCode);
128126
if ((requestCode == 0) && resultCode == -1) {
129127
if (data == null) {
130128
if (DEBUG) Log.d(TAG, "onActivityResult camera");

app/src/main/java/in/tosc/studddin/fragments/listings/ListingsSearchFragment.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ private void fetchListings(String text) {
177177
query.whereContainedIn(ParseTables.Listings.CATEGORY, categories);
178178
if (text == null) {
179179
//if (filterPrefs.getString("sortby", "nearest").equalsIgnoreCase("recent"))
180-
query.orderByDescending(ParseTables.Listings.CREATED_AT);
180+
query.orderByDescending(ParseTables.Listings.CREATED_AT);
181181
//else
182-
//query.whereNear(ParseTables.Listings.LOCATION,location);
182+
//query.whereNear(ParseTables.Listings.LOCATION,location);
183183
query.findInBackground(new FindCallback<ParseObject>() {
184184
@Override
185185
public void done(final List<ParseObject> parseObjects, ParseException e) {
186-
Log.d("Objects: ","" +parseObjects);
186+
Log.d("Objects: ", "" + parseObjects);
187187
if (e == null) {
188188
doneFetching(parseObjects);
189189
} else {
@@ -211,12 +211,12 @@ public void done(final List<ParseObject> parseObjects, ParseException e) {
211211
ParseQuery<ParseObject> mainQuery = ParseQuery.or(queries);
212212
mainQuery.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
213213
//if (filterPrefs.getString("sortby", "nearest").compareTo("recent") == 0)
214-
mainQuery.orderByDescending(ParseTables.Listings.CREATED_AT);
214+
mainQuery.orderByDescending(ParseTables.Listings.CREATED_AT);
215215
//else
216216
// mainQuery.whereNear("location",location);
217217
mainQuery.findInBackground(new FindCallback<ParseObject>() {
218218
public void done(List<ParseObject> results, ParseException e) {
219-
if(e==null)
219+
if (e == null)
220220
doneFetching(results);
221221
else
222222
e.printStackTrace(); // shouldn't happen
@@ -261,7 +261,7 @@ public void onBindViewHolder(final ViewHolder viewHolder, final int i) {
261261
public void done(byte[] bytes, ParseException e) {
262262
}
263263
});
264-
try{
264+
try {
265265
double distance = mDataset.get(i).getParseGeoPoint(ParseTables.Listings.LOCATION).distanceInKilometersTo(location);
266266
if (distance < 10 && distance >= 0.1)
267267
viewHolder.listing_distance.setText(String.format("%.1f", distance) + " km away");
@@ -282,7 +282,7 @@ public void onClick(View view) {
282282
}
283283
}
284284
});
285-
}catch(Exception e){
285+
} catch (Exception e) {
286286
viewHolder.listing_distance.setText("Unknown");
287287
}
288288
}

app/src/main/java/in/tosc/studddin/fragments/listings/ListingsUploadFragment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ public void onClick(View view) {
130130
bitmap.compress(Bitmap.CompressFormat.JPEG, 25, stream);
131131
byteArray = stream.toByteArray();
132132
}
133-
try{
133+
try {
134134
ParseFile file = new ParseFile(ParseTables.Listings.LISTING_PNG, byteArray);
135135
file.saveInBackground();
136136
upload.put(ParseTables.Listings.IMAGE, file);
137137
upload.put(ParseTables.Listings.OWNER_NAME, ParseUser.getCurrentUser().getString(ParseTables.Users.NAME));
138138
upload.put(ParseTables.Listings.LISTING_NAME, listing.getText().toString());
139139
upload.put(ParseTables.Listings.LISTING_DESC, listing_desc.getText().toString());
140140
upload.put(ParseTables.Listings.MOBILE, mobile.getText().toString());
141-
if(point!=null)
141+
if (point != null)
142142
upload.put(ParseTables.Listings.LOCATION, point);
143143
upload.put(ParseTables.Listings.CATEGORY, category.getSelectedItem().toString());
144144

@@ -150,8 +150,8 @@ public void done(ParseException e) {
150150
Toast.LENGTH_SHORT).show();
151151
}
152152
});
153-
}catch(Exception e){
154-
Toast.makeText(getActivity(),"Please connect to the Internet",Toast.LENGTH_SHORT).show();
153+
} catch (Exception e) {
154+
Toast.makeText(getActivity(), "Please connect to the Internet", Toast.LENGTH_SHORT).show();
155155
}
156156
}
157157
break;

app/src/main/java/in/tosc/studddin/fragments/listings/MyListingsFragment.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public MyListingsFragment() {
5151
public View onCreateView(LayoutInflater inflater, ViewGroup container,
5252
Bundle savedInstanceState) {
5353
// Inflate the layout for this fragment
54-
rootView = inflater.inflate(R.layout.fragment_my_listings, container, false);
54+
rootView = inflater.inflate(R.layout.fragment_my_listings, container, false);
5555
loader = (ProgressBarCircular) rootView.findViewById(R.id.progressBar);
5656
loader.setBackgroundColor(getResources().getColor(R.color.listingsColorPrimaryDark));
5757
mEmptyView = (ScrollView) rootView.findViewById(R.id.listing_empty);
@@ -65,7 +65,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
6565
return rootView;
6666
}
6767

68-
private void fetchMyListings(){
68+
private void fetchMyListings() {
6969
ParseQuery<ParseObject> query = new ParseQuery<>(
7070
ParseTables.Listings.LISTINGS);
7171
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
@@ -88,7 +88,7 @@ private void doneFetching(List<ParseObject> parseObjects) {
8888
mAdapter.notifyDataSetChanged();
8989
loader.setVisibility(View.GONE);
9090
mRecyclerView.setAdapter(mAdapter);
91-
if(mAdapter.getItemCount()==0) {
91+
if (mAdapter.getItemCount() == 0) {
9292
mEmptyView.setVisibility(View.VISIBLE);
9393
mListings.setVisibility(View.GONE);
9494
}
@@ -150,14 +150,13 @@ public void onClick(View view) {
150150
object.deleteInBackground(new DeleteCallback() {
151151
@Override
152152
public void done(ParseException e) {
153-
if(e==null){
153+
if (e == null) {
154154
mDataset.remove(getPosition());
155155
notifyItemRemoved(getPosition());
156156
notifyItemRangeChanged(getPosition(), mDataset.size());
157157
fetchMyListings();
158-
}
159-
else
160-
Toast.makeText(getActivity(),"Please connect to the Internet",Toast.LENGTH_SHORT).show();
158+
} else
159+
Toast.makeText(getActivity(), "Please connect to the Internet", Toast.LENGTH_SHORT).show();
161160
}
162161
});
163162

0 commit comments

Comments
 (0)