Floating Action Button Added Icons for design Added
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.maptology.android.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import com.maptology.android.app.R;
|
||||
|
||||
/**
|
||||
@@ -21,7 +23,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
* A reference to the current fragment.
|
||||
*/
|
||||
private MapFragment fragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -30,6 +31,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
getSupportActionBar().setDisplayUseLogoEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
setContentView(R.layout.activity);
|
||||
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
fragment = (MapFragment)getSupportFragmentManager().findFragmentByTag(TAG);
|
||||
} else {
|
||||
@@ -38,6 +41,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
ft.add(R.id.container, fragment, TAG);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import android.location.LocationListener;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -99,6 +102,12 @@ public class MapFragment extends Fragment {
|
||||
private LocationListener listener;
|
||||
|
||||
public static boolean stopService=false;
|
||||
|
||||
|
||||
private ShareFragment shareFragment;
|
||||
|
||||
private FloatingActionButton floatingActionButton;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -127,6 +136,7 @@ public class MapFragment extends Fragment {
|
||||
mapCenterTextView = (TextView) view.findViewById(R.id.location);
|
||||
mapZoomLevelTextView = (TextView) view.findViewById(R.id.zoomLevel);
|
||||
map = (MapView) view.findViewById(R.id.map);
|
||||
floatingActionButton=(FloatingActionButton)view.findViewById(R.id.floatingActionButton);
|
||||
// configure the map
|
||||
MapOptions mapOptions = new MapOptions();
|
||||
mapOptions.minZoom = 4;
|
||||
@@ -192,6 +202,19 @@ public class MapFragment extends Fragment {
|
||||
makeLocationListener();
|
||||
tracker=new GPSTracker(getContext(),listener);
|
||||
}
|
||||
floatingActionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
System.out.println("Button clicked!");
|
||||
shareFragment=new ShareFragment();
|
||||
|
||||
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.mapFragment, shareFragment);
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.maptology.android.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ShareFragment extends Fragment {
|
||||
|
||||
private TextView destinationTextView;
|
||||
private TextView messageTextview;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view= inflater.inflate(R.layout.share_fragment,container,false);
|
||||
destinationTextView=(TextView)view.findViewById(R.id.destinationTextView);
|
||||
messageTextview=(TextView)view.findViewById(R.id.messageTextView);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 428 B |
Binary file not shown.
|
After Width: | Height: | Size: 349 B |
Binary file not shown.
|
After Width: | Height: | Size: 644 B |
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
|
||||
<RelativeLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.1">
|
||||
<com.locoslab.capi.android.leafless.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:saveEnabled="false"/>
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignRight="@id/map"
|
||||
android:layout_alignBottom="@id/map"
|
||||
android:src="@drawable/ic_send_white_36dp"
|
||||
android:backgroundTint="@android:color/holo_blue_dark"
|
||||
android:layout_marginBottom="15sp"
|
||||
android:layout_marginRight="15sp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/zoomLevel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/zoom_angle"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<TextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/longitude_latitude"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -2,28 +2,43 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/mapFragment">
|
||||
|
||||
|
||||
<RelativeLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.1">
|
||||
<com.locoslab.capi.android.leafless.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:saveEnabled="false"/>
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignRight="@id/map"
|
||||
android:layout_alignBottom="@id/map"
|
||||
android:src="@drawable/ic_send_white_36dp"
|
||||
android:backgroundTint="@android:color/holo_blue_dark"
|
||||
android:layout_marginBottom="15sp"
|
||||
android:layout_marginRight="15sp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.locoslab.capi.android.leafless.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="0.1"
|
||||
android:saveEnabled="false"/>
|
||||
<TextView
|
||||
android:id="@+id/zoomLevel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/zoom_angle"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<TextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/longitude_latitude"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="?android:dividerHorizontal"
|
||||
android:showDividers="middle"
|
||||
android:id="@+id/shareFragment">
|
||||
|
||||
<EditText android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/messageTextView"
|
||||
android:hint="Message"
|
||||
android:layout_marginTop="20sp"
|
||||
android:inputType="text"
|
||||
android:drawableLeft="@drawable/ic_message_black_36dp"
|
||||
android:paddingLeft="10sp"
|
||||
android:drawablePadding="10sp"/>
|
||||
<EditText android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/destinationTextView"
|
||||
android:hint="Destination"
|
||||
android:layout_marginTop="20sp"
|
||||
android:inputType="text"
|
||||
android:paddingLeft="10sp"
|
||||
android:drawablePadding="10sp"
|
||||
android:drawableLeft="@drawable/ic_card_travel_black_36dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user