-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Saurabh Joshi
committed
Jul 1, 2014
1 parent
c474a16
commit 9cbf490
Showing
10 changed files
with
117 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
vitinfo2/src/main/java/com/karthikb351/vitinfo2/fragments/MapFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.karthikb351.vitinfo2.fragments; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuInflater; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.webkit.WebView; | ||
import android.webkit.WebViewClient; | ||
|
||
import com.karthikb351.vitinfo2.Home; | ||
import com.karthikb351.vitinfo2.R; | ||
|
||
/** | ||
* Created by saurabh on 7/1/14. | ||
*/ | ||
public class MapFragment extends Fragment { | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View v = inflater.inflate(R.layout.fragment_map,container, false); | ||
setHasOptionsMenu(true); | ||
|
||
((Home) getActivity()).setSupportProgressBarIndeterminateVisibility(true); | ||
|
||
WebView view = (WebView) v.findViewById(R.id.img_map); | ||
view.setVisibility(View.GONE); | ||
|
||
|
||
view.getSettings().setBuiltInZoomControls(true); | ||
|
||
view.getSettings().setLoadWithOverviewMode(true); | ||
|
||
view.setWebViewClient(new WebViewClient() { | ||
|
||
@Override | ||
public void onPageFinished(WebView view, String url) { | ||
super.onPageFinished(view, url); | ||
view.setVisibility(View.VISIBLE); | ||
((Home) getActivity()).setSupportProgressBarIndeterminateVisibility(false); | ||
} | ||
|
||
@Override | ||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { | ||
((Home) getActivity()).setSupportProgressBarIndeterminateVisibility(false); | ||
} | ||
}); | ||
|
||
view.loadUrl("file:///android_asset/vit_map.jpg"); | ||
|
||
return v; | ||
} | ||
|
||
@Override | ||
public void onCreateOptionsMenu( | ||
Menu menu, MenuInflater inflater) { | ||
inflater.inflate(R.menu.menu_fragment_map, menu); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// handle item selection | ||
switch (item.getItemId()) { | ||
case R.id.menu_gmaps: | ||
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, | ||
Uri.parse("https://www.google.com/maps/place/Vellore+Institute+of+Technology/@12.971749,79.159694,17z/data=!3m1!4b1!4m2!3m1!1s0x3bad479f0ccbe067:0xfef222e5f36ecdeb")); | ||
startActivity(intent); | ||
break; | ||
} | ||
return true; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_margin="0dp" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<WebView | ||
android:id="@+id/img_map" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
android:background="@android:color/transparent" | ||
android:layout_centerVertical="true" | ||
android:layout_centerHorizontal="true" | ||
/> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<item | ||
android:id="@+id/menu_gmaps" | ||
android:icon="@drawable/gmaps" | ||
android:title="Google Maps" | ||
app:showAsAction = "always"> | ||
</item> | ||
|
||
</menu> |