diff --git a/.idea/misc.xml b/.idea/misc.xml
index de84a51..0a0628a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,9 @@
+
+
+
diff --git a/app/app.iml b/app/app.iml
index 2f1173d..4dce980 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -80,7 +80,6 @@
-
diff --git a/app/build.gradle b/app/build.gradle
index f7c7d12..f7877ae 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,5 +22,4 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.0.0'
- compile 'com.android.support:appcompat-v7:20.0.0'
}
diff --git a/app/src/main/java/com/androidbootcamp/sunshine/DetailActivity.java b/app/src/main/java/com/androidbootcamp/sunshine/DetailActivity.java
index 9a728ac..bafec1f 100644
--- a/app/src/main/java/com/androidbootcamp/sunshine/DetailActivity.java
+++ b/app/src/main/java/com/androidbootcamp/sunshine/DetailActivity.java
@@ -2,12 +2,11 @@
import android.app.Activity;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
-public class DetailActivity extends ActionBarActivity {
+public class DetailActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
diff --git a/app/src/main/java/com/androidbootcamp/sunshine/DetailFragment.java b/app/src/main/java/com/androidbootcamp/sunshine/DetailFragment.java
index 66eb1ff..e257945 100644
--- a/app/src/main/java/com/androidbootcamp/sunshine/DetailFragment.java
+++ b/app/src/main/java/com/androidbootcamp/sunshine/DetailFragment.java
@@ -3,8 +3,6 @@
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v4.view.MenuItemCompat;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -23,6 +21,8 @@ public class DetailFragment extends Fragment {
public String mForecastStr;
public static final String LOG_TAG = DetailFragment.class.getSimpleName();
+ private ShareActionProvider mShareActionProvider;
+
public DetailFragment() {
setHasOptionsMenu(true);
}
@@ -43,24 +43,23 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- //inflate the menu. This adds the menu item to the ActionBar
+ // inflate the menu. This adds the menu item to the ActionBar
inflater.inflate(R.menu.detail_fragment, menu);
-/*
- //Retrieve the share menu item
-*/
+ // Retrieve the share menu item
MenuItem item = menu.findItem(R.id.menu_item_share);
- //fetch and store the ActionProvider
- android.support.v7.widget.ShareActionProvider mShareActionProvider =
- (android.support.v7.widget.ShareActionProvider) MenuItemCompat.getActionProvider(item);
- //Attach the intent to the ActionProvider. You can update this at any time.
- //like when users select a new piece of data they'd like to share
+ // fetch and store the ActionProvider
+ mShareActionProvider =
+ (ShareActionProvider) item.getActionProvider();
+ // Attach the intent to the ActionProvider. You can update this at any time.
+ // like when users select a new piece of data they'd like to share
+ setShareIntent(createShareForecastIntent());
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ private void setShareIntent(Intent shareIntent) {
if (mShareActionProvider != null) {
- mShareActionProvider.setShareIntent(createShareForecastIntent());
- Log.d(LOG_TAG, "Setting share intent");
- } else {
- Log.d(LOG_TAG, "Share Action Provider is null");
+ mShareActionProvider.setShareIntent(shareIntent);
}
- super.onCreateOptionsMenu(menu, inflater);
}
diff --git a/app/src/main/java/com/androidbootcamp/sunshine/data/WeatherContract.java b/app/src/main/java/com/androidbootcamp/sunshine/data/WeatherContract.java
deleted file mode 100644
index 2649eea..0000000
--- a/app/src/main/java/com/androidbootcamp/sunshine/data/WeatherContract.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.androidbootcamp.sunshine.data;
-
-/**
- * Created by Ye Lin Aung on 14/09/21.
- */
-public class WeatherContract {
-}
diff --git a/app/src/main/res/menu/detail_fragment.xml b/app/src/main/res/menu/detail_fragment.xml
index 1554c58..9abc329 100644
--- a/app/src/main/res/menu/detail_fragment.xml
+++ b/app/src/main/res/menu/detail_fragment.xml
@@ -1,12 +1,10 @@
-