Merge branch 'infoIcons' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
6498f2e58d
@ -29,7 +29,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -7,6 +7,7 @@ import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -20,16 +21,20 @@ import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||
import com.uam.wmi.findmytutor.utils.FeedbackUtils;
|
||||
import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RxSearchObservable;
|
||||
|
||||
@ -76,6 +81,7 @@ public abstract class BaseActivity
|
||||
private ActiveFragment activeFragment = ActiveFragment.NONE;
|
||||
private Fragment activeBottomMenu = null;
|
||||
private SearchView searchView;
|
||||
public MenuItem infoMenuItem;
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
@ -266,6 +272,8 @@ public abstract class BaseActivity
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
infoMenuItem = menu.findItem(R.id.action_info);
|
||||
|
||||
|
||||
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
|
||||
searchView = (SearchView) myActionMenuItem.getActionView();
|
||||
@ -313,6 +321,33 @@ public abstract class BaseActivity
|
||||
if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId()==R.id.action_info){
|
||||
int layoutID;
|
||||
switch (activeFragment){
|
||||
case SHARED_PREFERENCES:
|
||||
layoutID = R.layout.info_popup_sharing_tab;
|
||||
break;
|
||||
case USER_LIST:
|
||||
layoutID = R.layout.info_popup_userlist;
|
||||
break;
|
||||
default:
|
||||
layoutID = R.layout.info_popup_map;
|
||||
}
|
||||
|
||||
View popupView = getLayoutInflater().inflate(layoutID,null);
|
||||
|
||||
PopupWindow popupWindow = new PopupWindow(popupView,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// If the PopupWindow should be focusable
|
||||
popupWindow.setFocusable(true);
|
||||
// If you need the PopupWindow to dismiss when when touched outside
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable());
|
||||
// Get the View's(the one that was clicked in the Fragment) location
|
||||
View anchorView= getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
popupWindow.showAtLocation(anchorView,Gravity.TOP|Gravity.END, 0, 0);
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,6 @@ public class MapActivity extends BaseActivity
|
||||
|
||||
};
|
||||
|
||||
findViewById(R.id.mapInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v, R.layout.info_popup_map));
|
||||
selectLocationButton = findViewById(R.id.select_location_button);
|
||||
removeLocationButton = findViewById(R.id.remove_location_button);
|
||||
mapView = findViewById(R.id.mapView);
|
||||
|
@ -84,7 +84,6 @@ public class UsersListFragment extends Fragment {
|
||||
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
ButterKnife.bind(this, view);
|
||||
view.findViewById(R.id.userListInfoImageButton).setOnClickListener(v -> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_userlist));
|
||||
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
|
@ -20,12 +20,6 @@
|
||||
|
||||
</com.mapbox.mapboxsdk.maps.MapView>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/mapInfoImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
mapbox:srcCompat="@drawable/outline_info_24"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -6,8 +6,6 @@
|
||||
android:fontFamily="@font/lato_regular"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.uam.wmi.findmytutor.utils.SharingInfoPopupButtonPreference/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_category_location"
|
||||
android:key="category_sharing">
|
||||
|
@ -10,13 +10,6 @@
|
||||
|
||||
<include layout="@layout/users_list_main" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/userListInfoImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
mapbox:srcCompat="@drawable/outline_info_24"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
|
@ -8,4 +8,11 @@
|
||||
app:showAsAction="always"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
android:title="@string/search"/>
|
||||
<item
|
||||
android:id="@+id/action_info"
|
||||
app:showAsAction="ifRoom|collapseActionView"
|
||||
android:icon="@drawable/outline_info_24"
|
||||
android:titleCondensed="@string/access_token"
|
||||
android:actionLayout="@layout/info_popup_map"
|
||||
android:title="Info" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user