Commit 84e0ded5 authored by mayu's avatar mayu

avoiding merge conflict in .idea

parents 4675a5c0 6a81f4a9
......@@ -4,6 +4,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/IITB-App.iml" filepath="$PROJECT_DIR$/IITB-App.iml" />
<module fileurl="file://$PROJECT_DIR$/IITBApp.iml" filepath="$PROJECT_DIR$/IITBApp.iml" />
<module fileurl="file://$PROJECT_DIR$/InstiApp.iml" filepath="$PROJECT_DIR$/InstiApp.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
......
......@@ -291,7 +291,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
FragmentManager manager = getSupportFragmentManager();
if (fragment instanceof FeedFragment)
manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
FragmentTransaction transaction = manager.beginTransaction();
/* Animate only for ProfileFragment */
if (fragment instanceof ProfileFragment) {
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
}
transaction.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag());
transaction.addToBackStack(fragment.getTag()).commit();
}
......
......@@ -54,9 +54,8 @@ public class NewsAdapter extends RecyclerView.Adapter<NewsAdapter.ViewHolder> {
NewsArticle article = newsArticles.get(position);
Markwon.setMarkdown(holder.articleTitle, article.getTitle());
holder.articleBody.setText(article.getBody().getBodyName());
try {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US);
Date publishedDate = dateFormat.parse(article.getPublished());
Date publishedDate = article.getPublished();
Calendar calendar = Calendar.getInstance();
calendar.setTime(publishedDate);
DateFormat displayFormat;
......@@ -66,9 +65,7 @@ public class NewsAdapter extends RecyclerView.Adapter<NewsAdapter.ViewHolder> {
displayFormat = new SimpleDateFormat("EEE, MMM d, ''yy, HH:mm", Locale.US);
}
holder.articlePublished.setText(displayFormat.format(publishedDate));
} catch (ParseException e) {
e.printStackTrace();
}
Markwon.setMarkdown(holder.articleContent, article.getContent());
}
......
......@@ -51,9 +51,8 @@ public class PlacementBlogAdapter extends RecyclerView.Adapter<PlacementBlogAdap
public void onBindViewHolder(ViewHolder holder, int position) {
PlacementBlogPost post = posts.get(position);
Markwon.setMarkdown(holder.postTitle, post.getTitle());
try {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US);
Date publishedDate = dateFormat.parse(post.getPublished());
Date publishedDate = post.getPublished();
Calendar calendar = Calendar.getInstance();
calendar.setTime(publishedDate);
DateFormat displayFormat;
......@@ -63,9 +62,7 @@ public class PlacementBlogAdapter extends RecyclerView.Adapter<PlacementBlogAdap
displayFormat = new SimpleDateFormat("EEE, MMM d, ''yy, HH:mm", Locale.US);
}
holder.postPublished.setText(displayFormat.format(publishedDate));
} catch (ParseException e) {
holder.postPublished.setText(post.getPublished());
}
Markwon.setMarkdown(holder.postContent, post.getContent());
}
......
......@@ -51,9 +51,8 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<TrainingBlogAdapte
public void onBindViewHolder(ViewHolder holder, int position) {
TrainingBlogPost post = posts.get(position);
Markwon.setMarkdown(holder.postTitle, post.getTitle());
try {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US);
Date publishedDate = dateFormat.parse(post.getPublished());
Date publishedDate = post.getPublished();
Calendar calendar = Calendar.getInstance();
calendar.setTime(publishedDate);
DateFormat displayFormat;
......@@ -63,9 +62,7 @@ public class TrainingBlogAdapter extends RecyclerView.Adapter<TrainingBlogAdapte
displayFormat = new SimpleDateFormat("EEE, MMM d, ''yy, HH:mm", Locale.US);
}
holder.postPublished.setText(displayFormat.format(publishedDate));
} catch (ParseException e) {
holder.postPublished.setText(post.getPublished());
}
Markwon.setMarkdown(holder.postContent, post.getContent());
}
......
......@@ -18,7 +18,7 @@ public abstract class AppDatabase extends RoomDatabase {
Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, "database")
// allow queries on the main thread.
// Don't do this on a real app! See PersistenceBasicSample for an example.
.allowMainThreadQueries()
// .allowMainThreadQueries()
.build();
}
return INSTANCE;
......
......@@ -6,7 +6,7 @@ import android.arch.persistence.room.PrimaryKey;
import com.google.gson.annotations.SerializedName;
import java.util.Map;
import java.sql.Timestamp;
@Entity(tableName = "news")
......@@ -33,13 +33,13 @@ public class NewsArticle {
@ColumnInfo(name = "published")
@SerializedName("published")
private String published;
private Timestamp published;
@ColumnInfo(name = "body")
@SerializedName("body")
private Body body;
public NewsArticle(String articleID, String link, String title, String content, String published, Body body) {
public NewsArticle(String articleID, String link, String title, String content, Timestamp published, Body body) {
this.articleID = articleID;
this.link = link;
this.title = title;
......@@ -80,11 +80,11 @@ public class NewsArticle {
this.content = content;
}
public String getPublished() {
public Timestamp getPublished() {
return published;
}
public void setPublished(String published) {
public void setPublished(Timestamp published) {
this.published = published;
}
......
......@@ -6,6 +6,8 @@ import android.arch.persistence.room.PrimaryKey;
import com.google.gson.annotations.SerializedName;
import java.sql.Timestamp;
@Entity(tableName = "placementBlogPosts")
public class PlacementBlogPost {
......@@ -31,9 +33,9 @@ public class PlacementBlogPost {
@ColumnInfo(name = "published")
@SerializedName("published")
private String published;
private Timestamp published;
public PlacementBlogPost(String postID, String link, String title, String content, String published) {
public PlacementBlogPost(String postID, String link, String title, String content, Timestamp published) {
this.postID = postID;
this.link = link;
this.title = title;
......@@ -73,11 +75,11 @@ public class PlacementBlogPost {
this.content = content;
}
public String getPublished() {
public Timestamp getPublished() {
return published;
}
public void setPublished(String published) {
public void setPublished(Timestamp published) {
this.published = published;
}
}
......@@ -6,6 +6,8 @@ import android.arch.persistence.room.PrimaryKey;
import com.google.gson.annotations.SerializedName;
import java.sql.Timestamp;
@Entity(tableName = "trainingBlogPosts")
public class TrainingBlogPost {
......@@ -31,9 +33,9 @@ public class TrainingBlogPost {
@ColumnInfo(name = "published")
@SerializedName("published")
private String published;
private Timestamp published;
public TrainingBlogPost(String postID, String link, String title, String content, String published) {
public TrainingBlogPost(String postID, String link, String title, String content, Timestamp published) {
this.postID = postID;
this.link = link;
this.title = title;
......@@ -73,11 +75,11 @@ public class TrainingBlogPost {
this.content = content;
}
public String getPublished() {
public Timestamp getPublished() {
return published;
}
public void setPublished(String published) {
public void setPublished(Timestamp published) {
this.published = published;
}
}
......@@ -93,12 +93,7 @@ public class BodyFragment extends Fragment {
/* Initialize */
appDatabase = AppDatabase.getAppDatabase(getContext());
Body[] inLocalDb = appDatabase.dbDao().getBody(min_body.getBodyID());
if (inLocalDb.length > 0) {
displayBody(inLocalDb[0]);
} else {
updateBody();
}
new getDbBody().execute(min_body.getBodyID());
bodySwipeRefreshLayout=getActivity().findViewById(R.id.body_swipe_refresh_layout);
bodySwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
......@@ -116,7 +111,7 @@ public class BodyFragment extends Fragment {
if (response.isSuccessful()) {
Body body = response.body();
appDatabase.dbDao().insertBody(body);
new insertDbBody().execute(body);
displayBody(body);
bodySwipeRefreshLayout.setRefreshing(false);
......@@ -209,6 +204,7 @@ public class BodyFragment extends Fragment {
EventFragment eventFragment = new EventFragment();
eventFragment.setArguments(bundle);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
ft.addToBackStack(eventFragment.getTag());
ft.commit();
......@@ -226,6 +222,30 @@ public class BodyFragment extends Fragment {
}
}
private class insertDbBody extends AsyncTask<Body, Void, Integer> {
@Override
protected Integer doInBackground(Body... body) {
appDatabase.dbDao().insertBody(body[0]);
return 1;
}
}
private class getDbBody extends AsyncTask<String, Void, Body[]> {
@Override
protected Body[] doInBackground(String... id) {
return appDatabase.dbDao().getBody(min_body.getBodyID());
}
@Override
protected void onPostExecute(Body[] result) {
if (result.length > 0) {
displayBody(result[0]);
} else {
updateBody();
}
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
......
......@@ -51,9 +51,9 @@ public class EventFragment extends BaseFragment {
Event event;
Button goingButton;
Button interestedButton;
Button notGoingButton;
ImageButton shareEventButton;
ImageButton navigateButton;
ImageButton webEventButton;
ImageButton shareEventButton;
RecyclerView bodyRecyclerView;
private AppDatabase appDatabase;
String TAG = "EventFragment";
......@@ -93,8 +93,9 @@ public class EventFragment extends BaseFragment {
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description);
goingButton = getActivity().findViewById(R.id.going_button);
interestedButton = getActivity().findViewById(R.id.interested_button);
shareEventButton = getActivity().findViewById(R.id.share_event_button);
navigateButton = getActivity().findViewById(R.id.navigate_button);
webEventButton = getActivity().findViewById(R.id.web_event_button);
shareEventButton = getActivity().findViewById(R.id.share_event_button);
Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture);
eventTitle.setText(event.getEventName());
......@@ -119,6 +120,7 @@ public class EventFragment extends BaseFragment {
Body body = bodyList.get(position);
BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag());
ft.addToBackStack(bodyFragment.getTag());
ft.commit();
......@@ -138,8 +140,20 @@ public class EventFragment extends BaseFragment {
interestedButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_INTERESTED ? R.color.colorAccent : R.color.colorWhite));
goingButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_GOING ? R.color.colorAccent : R.color.colorWhite));
navigateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Venue primaryVenue = event.getEventVenues().get(0);
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + primaryVenue.getVenueLatitude() + "," + primaryVenue.getVenueLongitude() + "(" + primaryVenue.getVenueName() + ")");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
});
shareEventButton.setOnClickListener(new View.OnClickListener() {
String shareUrl = ShareURLMaker.getEventURL(event);
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_SEND);
......@@ -149,11 +163,11 @@ public class EventFragment extends BaseFragment {
startActivity(Intent.createChooser(i, "Share URL"));
}
});
if (event.getEventWebsiteURL() != null && !event.getEventWebsiteURL().isEmpty())
{
if (event.getEventWebsiteURL() != null && !event.getEventWebsiteURL().isEmpty()) {
webEventButton.setVisibility(View.VISIBLE);
webEventButton.setOnClickListener(new View.OnClickListener() {
String eventwebURL = event.getEventWebsiteURL();
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(eventwebURL));
......
......@@ -64,6 +64,7 @@ public class FeedFragment extends BaseFragment {
AddEventFragment addEventFragment = new AddEventFragment();
addEventFragment.setArguments(getArguments());
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.relative_layout, addEventFragment);
ft.addToBackStack("addEvent");
ft.commit();
......@@ -146,6 +147,7 @@ public class FeedFragment extends BaseFragment {
eventFragment.setArguments(bundle);
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
transaction.addToBackStack(eventFragment.getTag()).commit();
}
......
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="1280"
android:valueTo="0"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="-1280"
android:valueTo="0"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="-1280"
android:duration="400"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1280"
android:duration="400"/>
</set>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2L4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71z"/>
</vector>
......@@ -57,24 +57,35 @@
<ImageButton
android:id="@+id/web_event_button"
android:layout_width="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Event Website"
android:src="@drawable/ic_language_black_24dp"
android:layout_marginStart="8dp"
app:srcCompat="@drawable/ic_language_black_24dp"
android:tint="@color/colorWhite"
android:visibility="invisible"/>
<ImageButton
android:id="@+id/navigate_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Navigate"
android:layout_marginStart="8dp"
app:srcCompat="@drawable/baseline_navigation_24"
android:tint="@color/colorWhite" />
<ImageButton
android:id="@+id/share_event_button"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Share Event"
android:layout_marginStart="8dp"
android:src="@drawable/ic_menu_share"
android:tint="@color/colorWhite" />
</LinearLayout>
......
......@@ -13,8 +13,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/feed_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp" />
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
......
......@@ -13,8 +13,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/news_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp" />
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
......@@ -13,8 +13,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/placement_feed_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp" />
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
......@@ -13,8 +13,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/training_feed_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp" />
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment