Compare commits
8 Commits
v0.2
...
adding-map
Author | SHA1 | Date | |
---|---|---|---|
be910bcabe | |||
fdb314c48b | |||
b8541c994a | |||
2a62da3cf2 | |||
7c5de6ccd7 | |||
4ff6c569d0 | |||
c58041fc20 | |||
b3169f6525 |
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_XL_API_30.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2021-09-14T16:48:49.750165Z" />
|
||||
</component>
|
||||
</project>
|
6
.idea/misc.xml
generated
6
.idea/misc.xml
generated
@ -6,12 +6,14 @@
|
||||
<entry key="../../../../layout/custom_preview.xml" value="0.5661458333333333" />
|
||||
<entry key="app/src/main/res/layout/activity_geofavorite_detail.xml" value="0.4" />
|
||||
<entry key="app/src/main/res/layout/activity_list_view.xml" value="0.5307291666666667" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5307291666666667" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5218150087260035" />
|
||||
<entry key="app/src/main/res/layout/fragment_geofavorite_list.xml" value="0.1734375" />
|
||||
<entry key="app/src/main/res/layout/fragment_map.xml" value="0.19010416666666666" />
|
||||
<entry key="app/src/main/res/layout/item_geofav.xml" value="0.5307291666666667" />
|
||||
<entry key="app/src/main/res/menu/list_context_menu.xml" value="0.41944444444444445" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
||||
</project>
|
@ -9,3 +9,7 @@ A new geobookmark can be created on current location.
|
||||
|
||||
This work is heavily based on [matiasdelellis's Nextcloud SSO example](https://github.com/matiasdelellis/app-tutorial-android) to implement [Nextcloud single sign on](https://github.com/nextcloud/Android-SingleSignOn).
|
||||
|
||||
 
|
||||
|
||||
Download it from [the releases page](https://github.com/penguin86/nextcloud-maps-client/releases)
|
||||
|
||||
|
@ -55,15 +55,16 @@ dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
implementation 'com.android.support:design:30.0.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
||||
implementation "androidx.preference:preference:1.1.1"
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
// Retrofif2
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
@ -71,4 +72,8 @@ dependencies {
|
||||
|
||||
// Nextcloud SSO
|
||||
implementation "com.github.nextcloud:Android-SingleSignOn:0.5.6"
|
||||
|
||||
// OSMDroid
|
||||
compile 'org.osmdroid:osmdroid-android:6.1.10'
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 3,
|
||||
"version": 2,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
@ -10,11 +10,9 @@
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 2,
|
||||
"versionName": "0.2",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
]
|
||||
}
|
@ -34,7 +34,15 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.osmdroid.api.IMapController;
|
||||
import org.osmdroid.config.Configuration;
|
||||
import org.osmdroid.util.GeoPoint;
|
||||
import org.osmdroid.views.CustomZoomButtonsController;
|
||||
import org.osmdroid.views.overlay.Marker;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -61,9 +69,28 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// OSMDroid config
|
||||
Configuration.getInstance().load(getApplicationContext(),
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
|
||||
|
||||
mViewHolder = new ViewHolder(getLayoutInflater());
|
||||
mViewHolder.setOnSubmitListener(this::saveGeofavorite);
|
||||
setContentView(mViewHolder.getRootView());
|
||||
mViewHolder.setOnSubmitListener(new OnSubmitListener() {
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubmit() {
|
||||
saveGeofavorite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClicked() {
|
||||
Toast.makeText(GeofavoriteDetailActivity.this, "TODO: Open map activity with pin", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
if (getIntent().hasExtra(ARG_GEOFAVORITE)) {
|
||||
// Opening geofavorite from list
|
||||
@ -83,6 +110,24 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// OSMDroid config
|
||||
Configuration.getInstance().load(getApplicationContext(),
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
|
||||
mViewHolder.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
// OSMDroid config
|
||||
Configuration.getInstance().save(getApplicationContext(),
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
|
||||
mViewHolder.onPause();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the submit button is clicked
|
||||
* @param v The button
|
||||
@ -166,7 +211,7 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
mGeofavorite.setLat(location.getLatitude());
|
||||
mGeofavorite.setLng(location.getLongitude());
|
||||
// Update view
|
||||
mViewHolder.updateViewCoords(mGeofavorite.getCoordinatesString());
|
||||
mViewHolder.updateViewCoords(mGeofavorite);
|
||||
mViewHolder.setAccuracy(location.getAccuracy());
|
||||
}
|
||||
|
||||
@ -211,10 +256,23 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
private class ViewHolder implements View.OnClickListener {
|
||||
private final ActivityGeofavoriteDetailBinding binding;
|
||||
private OnSubmitListener listener;
|
||||
private Marker mapMarker;
|
||||
|
||||
public ViewHolder(LayoutInflater inflater) {
|
||||
this.binding = ActivityGeofavoriteDetailBinding.inflate(inflater);
|
||||
this.binding.submitBt.setOnClickListener(this);
|
||||
this.binding.mapBt.setOnClickListener(this);
|
||||
this.binding.backBt.setOnClickListener(this);
|
||||
|
||||
// Set map properties
|
||||
this.binding.map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER);
|
||||
this.binding.map.setMultiTouchControls(true);
|
||||
|
||||
// Create marker
|
||||
mapMarker = new Marker(binding.map);
|
||||
mapMarker.setIcon(AppCompatResources.getDrawable(GeofavoriteDetailActivity.this, R.drawable.ic_map_pin));
|
||||
mapMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
|
||||
binding.map.getOverlays().add(mapMarker);
|
||||
}
|
||||
|
||||
public View getRootView() {
|
||||
@ -227,11 +285,20 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
binding.createdTv.setText(new Date(item.getDateCreated() * 1000).toString());
|
||||
binding.modifiedTv.setText(new Date(item.getDateModified() * 1000).toString());
|
||||
binding.categoryTv.setText(item.getCategory()); // TODO: Category spinner from existing categories
|
||||
binding.coordsTv.setText(item.getCoordinatesString());
|
||||
updateViewCoords(item);
|
||||
}
|
||||
|
||||
public void updateViewCoords(String coords) {
|
||||
binding.coordsTv.setText(coords);
|
||||
public void updateViewCoords(Geofavorite item) {
|
||||
binding.coordsTv.setText(item.getCoordinatesString());
|
||||
|
||||
// Center map
|
||||
GeoPoint position = new GeoPoint(item.getLat(), item.getLng());
|
||||
IMapController mapController = binding.map.getController();
|
||||
mapController.setZoom(19.0f);
|
||||
mapController.setCenter(position);
|
||||
|
||||
// Set pin
|
||||
mapMarker.setPosition(position);
|
||||
}
|
||||
|
||||
public void updateModel(Geofavorite item) {
|
||||
@ -258,15 +325,31 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
binding.map.onResume();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
binding.map.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.submit_bt && this.listener != null) {
|
||||
this.listener.onSubmit();
|
||||
}
|
||||
if (v.getId() == R.id.map_bt && this.listener != null) {
|
||||
this.listener.onMapClicked();
|
||||
}
|
||||
if (v.getId() == R.id.back_bt && this.listener != null) {
|
||||
this.listener.onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected interface OnSubmitListener {
|
||||
void onSubmit();
|
||||
void onMapClicked();
|
||||
void onBackPressed();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package it.danieleverducci.nextcloudmaps.activity.main;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
|
||||
public interface GeofavoriteActivity {
|
||||
void showGeofavoriteDetailActivity(Geofavorite item);
|
||||
void showGeofavoriteDeteleDialog(Geofavorite item);
|
||||
void updateGeofavorites();
|
||||
void getGeofavorites();
|
||||
|
||||
}
|
@ -33,6 +33,7 @@ import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceManager;
|
||||
@ -61,7 +62,7 @@ import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.
|
||||
import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_CREATED;
|
||||
import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_TITLE;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements MainView, OnSortingOrderListener {
|
||||
public class MainActivity extends AppCompatActivity implements MainView, GeofavoriteActivity {
|
||||
|
||||
private static final int INTENT_ADD = 100;
|
||||
private static final int INTENT_EDIT = 200;
|
||||
@ -72,20 +73,13 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
private static final String NAVIGATION_KEY_SHOW_ABOUT = "about";
|
||||
private static final String NAVIGATION_KEY_SWITCH_ACCOUNT = "switch_account";
|
||||
|
||||
private SharedPreferences preferences;
|
||||
|
||||
private DrawerLayout drawerLayout;
|
||||
private Toolbar toolbar;
|
||||
private MaterialCardView homeToolbar;
|
||||
private SearchView searchView;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView recyclerView;
|
||||
private StaggeredGridLayoutManager layoutManager;
|
||||
private FloatingActionButton fab;
|
||||
|
||||
private MainPresenter presenter;
|
||||
private GeofavoriteAdapter geofavoriteAdapter;
|
||||
private ItemClickListener rvItemClickListener;
|
||||
|
||||
NavigationAdapter navigationCommonAdapter;
|
||||
|
||||
@ -94,56 +88,8 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
||||
int sortRule = preferences.getInt(getString(R.string.setting_sort_by), SORT_BY_CREATED);
|
||||
boolean gridViewEnabled = preferences.getBoolean(getString(R.string.setting_grid_view_enabled), false);
|
||||
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
layoutManager = new StaggeredGridLayoutManager(gridViewEnabled ? 2 : 1, StaggeredGridLayoutManager.VERTICAL);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
presenter = new MainPresenter(this);
|
||||
|
||||
rvItemClickListener = new ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(Geofavorite geofavorite) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_VIEW);
|
||||
i.setData(geofavorite.getGeoUri());
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemShareClick(Geofavorite item) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_SEND);
|
||||
i.setType("text/plain");
|
||||
String shareMessage = getString(R.string.share_message)
|
||||
.replace("{lat}", ""+item.getLat())
|
||||
.replace("{lng}", ""+item.getLng());
|
||||
i.putExtra(Intent.EXTRA_TEXT, shareMessage );
|
||||
startActivity(Intent.createChooser(i, getString(R.string.share_via)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDetailsClick(Geofavorite item) {
|
||||
showGeofavoriteDetailActivity(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDeleteClick(Geofavorite item) {
|
||||
showGeofavoriteDeteleDialog(item);
|
||||
}
|
||||
};
|
||||
|
||||
geofavoriteAdapter = new GeofavoriteAdapter(getApplicationContext(), rvItemClickListener);
|
||||
recyclerView.setAdapter(geofavoriteAdapter);
|
||||
geofavoriteAdapter.setSortRule(sortRule);
|
||||
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setOnRefreshListener(() -> presenter.getGeofavorites());
|
||||
|
||||
fab = findViewById(R.id.add);
|
||||
fab.setOnClickListener(view -> addGeofavorite());
|
||||
|
||||
@ -184,14 +130,7 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
AppCompatImageButton menuButton = findViewById(R.id.menu_button);
|
||||
menuButton.setOnClickListener(view -> drawerLayout.openDrawer(GravityCompat.START));
|
||||
|
||||
AppCompatImageView viewButton = findViewById(R.id.view_mode);
|
||||
viewButton.setOnClickListener(view -> {
|
||||
boolean gridEnabled = layoutManager.getSpanCount() == 1;
|
||||
onGridIconChosen(gridEnabled);
|
||||
});
|
||||
|
||||
updateSortingIcon(sortRule);
|
||||
updateGridIcon(gridViewEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -271,24 +210,24 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
|
||||
@Override
|
||||
public void showLoading() {
|
||||
swipeRefresh.setRefreshing(true);
|
||||
//todo notify GeofavoriteListConsumer.geoFavoriteLoading(true)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLoading() {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
//todo notify GeofavoriteListConsumer.geoFavoriteLoading(false)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetResult(List<Geofavorite> geofavorite_list) {
|
||||
geofavoriteAdapter.setGeofavoriteList(geofavorite_list);
|
||||
//todo notify GeofavoriteListConsumer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeofavoriteDeleted(int id) {
|
||||
// Update list
|
||||
// Notify fragment
|
||||
runOnUiThread(() -> {
|
||||
geofavoriteAdapter.removeById(id);
|
||||
//todo notify GeofavoriteListConsumer
|
||||
Toast.makeText(MainActivity.this, R.string.list_geofavorite_deleted, Toast.LENGTH_LONG).show();
|
||||
});
|
||||
}
|
||||
@ -300,38 +239,7 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSortingOrderChosen(int sortSelection) {
|
||||
geofavoriteAdapter.setSortRule(sortSelection);
|
||||
updateSortingIcon(sortSelection);
|
||||
|
||||
preferences.edit().putInt(getString(R.string.setting_sort_by), sortSelection).apply();
|
||||
}
|
||||
|
||||
public void updateSortingIcon(int sortSelection) {
|
||||
AppCompatImageView sortButton = findViewById(R.id.sort_mode);
|
||||
switch (sortSelection) {
|
||||
case SORT_BY_TITLE:
|
||||
sortButton.setImageResource(R.drawable.ic_alphabetical_asc);
|
||||
break;
|
||||
case SORT_BY_CREATED:
|
||||
sortButton.setImageResource(R.drawable.ic_modification_asc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onGridIconChosen(boolean gridEnabled) {
|
||||
layoutManager.setSpanCount(gridEnabled ? 2 : 1);
|
||||
updateGridIcon(gridEnabled);
|
||||
|
||||
preferences.edit().putBoolean(getString(R.string.setting_grid_view_enabled), gridEnabled).apply();
|
||||
}
|
||||
|
||||
public void updateGridIcon(boolean gridEnabled) {
|
||||
AppCompatImageView viewButton = findViewById(R.id.view_mode);
|
||||
viewButton.setImageResource(gridEnabled ? R.drawable.ic_view_list : R.drawable.ic_view_module);
|
||||
}
|
||||
|
||||
private void showGeofavoriteDeteleDialog(Geofavorite item) {
|
||||
public void showGeofavoriteDeteleDialog(Geofavorite item) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setMessage(getString(R.string.dialog_delete_message).replace("{name}", item.getName()))
|
||||
.setTitle(R.string.dialog_delete_title)
|
||||
@ -351,10 +259,22 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
ad.show();
|
||||
}
|
||||
|
||||
private void showGeofavoriteDetailActivity(Geofavorite item) {
|
||||
@Override
|
||||
public void updateGeofavorites() {
|
||||
presenter.getGeofavorites();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGeofavorites() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showGeofavoriteDetailActivity(Geofavorite item) {
|
||||
Intent i = new Intent(this, GeofavoriteDetailActivity.class);
|
||||
i.putExtra(GeofavoriteDetailActivity.ARG_GEOFAVORITE, item);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package it.danieleverducci.nextcloudmaps.fragments;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
|
||||
public interface GeofavoriteListConsumer {
|
||||
void onGeofavoritesUpdated(List<Geofavorite> geofavorites);
|
||||
void onGeofavoriteRemoved(Geofavorite geofavorite);
|
||||
void onGeofavoriteAdded(Geofavorite geofavorite);
|
||||
void onGeofavoriteLoading(boolean isLoading);
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package it.danieleverducci.nextcloudmaps.fragments;
|
||||
|
||||
import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_CREATED;
|
||||
import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_TITLE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.R;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteActivity;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.MainActivity;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.SortingOrderDialogFragment;
|
||||
import it.danieleverducci.nextcloudmaps.databinding.FragmentGeofavoriteListBinding;
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
|
||||
/**
|
||||
* Geofavorites list
|
||||
*/
|
||||
public class GeofavoriteListFragment extends Fragment implements GeofavoriteListConsumer, SortingOrderDialogFragment.OnSortingOrderListener {
|
||||
private FragmentGeofavoriteListBinding binding;
|
||||
private GeofavoriteAdapter geofavoriteAdapter;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
public GeofavoriteListFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (binding == null) {
|
||||
binding = FragmentGeofavoriteListBinding.inflate(
|
||||
LayoutInflater.from(container.getContext()),
|
||||
container,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
|
||||
binding.recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
int sortRule = preferences.getInt(getString(R.string.setting_sort_by), SORT_BY_CREATED);
|
||||
GeofavoriteAdapter.ItemClickListener rvItemClickListener = new GeofavoriteAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(Geofavorite geofavorite) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_VIEW);
|
||||
i.setData(geofavorite.getGeoUri());
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemShareClick(Geofavorite item) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_SEND);
|
||||
i.setType("text/plain");
|
||||
String shareMessage = getString(R.string.share_message)
|
||||
.replace("{lat}", ""+item.getLat())
|
||||
.replace("{lng}", ""+item.getLng());
|
||||
i.putExtra(Intent.EXTRA_TEXT, shareMessage );
|
||||
startActivity(Intent.createChooser(i, getString(R.string.share_via)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDetailsClick(Geofavorite item) {
|
||||
if (getActivity() instanceof GeofavoriteActivity)
|
||||
((GeofavoriteActivity)getActivity()).showGeofavoriteDetailActivity(item);
|
||||
else
|
||||
throw new IllegalStateException("Expected activity implementing GeofavoriteAcivity");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDeleteClick(Geofavorite item) {
|
||||
if (getActivity() instanceof GeofavoriteActivity)
|
||||
((GeofavoriteActivity)getActivity()).showGeofavoriteDeteleDialog(item);
|
||||
else
|
||||
throw new IllegalStateException("Expected activity implementing GeofavoriteAcivity");
|
||||
}
|
||||
};
|
||||
geofavoriteAdapter = new GeofavoriteAdapter(getContext(), rvItemClickListener);
|
||||
binding.recyclerView.setAdapter(geofavoriteAdapter);
|
||||
geofavoriteAdapter.setSortRule(sortRule);
|
||||
|
||||
binding.swipeRefresh.setOnRefreshListener(() ->
|
||||
((GeofavoriteActivity)getActivity()).updateGeofavorites());
|
||||
|
||||
return binding.root;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onGeofavoritesUpdated(List<Geofavorite> geofavorites) {
|
||||
if (geofavoriteAdapter != null)
|
||||
geofavoriteAdapter.setGeofavoriteList(geofavorites);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeofavoriteRemoved(Geofavorite geofavorite) {
|
||||
// Update list
|
||||
geofavoriteAdapter.removeById(geofavorite.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeofavoriteAdded(Geofavorite geofavorite) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeofavoriteLoading(boolean isLoading) {
|
||||
binding.swipeRefresh.setRefreshing(isLoading);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSortingOrderChosen(int sortSelection) {
|
||||
geofavoriteAdapter.setSortRule(sortSelection);
|
||||
updateSortingIcon(sortSelection);
|
||||
|
||||
preferences.edit().putInt(getString(R.string.setting_sort_by), sortSelection).apply();
|
||||
}
|
||||
|
||||
public void updateSortingIcon(int sortSelection) {
|
||||
// TODO: Gestire il bottone come bottone generico da aggiungere all'activity
|
||||
AppCompatImageView sortButton = findViewById(R.id.sort_mode);
|
||||
switch (sortSelection) {
|
||||
case SORT_BY_TITLE:
|
||||
sortButton.setImageResource(R.drawable.ic_alphabetical_asc);
|
||||
break;
|
||||
case SORT_BY_CREATED:
|
||||
sortButton.setImageResource(R.drawable.ic_modification_asc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package it.danieleverducci.nextcloudmaps.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link MapFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class MapFragment extends Fragment {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public MapFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment MapFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static MapFragment newInstance(String param1, String param2) {
|
||||
MapFragment fragment = new MapFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_map, container, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package it.danieleverducci.nextcloudmaps.fragments;
|
||||
|
||||
public interface SortableListFragment {
|
||||
|
||||
}
|
5
app/src/main/res/drawable/ic_map_pin.xml
Normal file
5
app/src/main/res/drawable/ic_map_pin.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="48dp" android:tint="#0082C9"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
|
||||
</vector>
|
@ -1,23 +0,0 @@
|
||||
<!--
|
||||
~ Nextcloud Maps Geofavorites for Android
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M9,5V9H21V5M9,19H21V15H9M9,14H21V10H9M4,9H8V5H4M4,19H8V15H4M4,14H8V10H4V14Z" />
|
||||
</vector>
|
@ -1,25 +0,0 @@
|
||||
<!--
|
||||
~ Nextcloud Maps Geofavorites for Android
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFF"
|
||||
android:pathData="M16,5V11H21V5M10,11H15V5H10M16,18H21V12H16M10,18H15V12H10M4,18H9V12H4M4,11H9V5H4V11Z" />
|
||||
</vector>
|
@ -2,127 +2,150 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ScrollView
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/root">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:padding="50dp"
|
||||
app:srcCompat="@drawable/ic_app"
|
||||
android:background="@color/defaultBrand" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_et"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/name"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"/>
|
||||
android:layout_height="200dp">
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="false"
|
||||
android:clickable="false"/>
|
||||
<View
|
||||
android:id="@+id/map_bt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</FrameLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description_et"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:gravity="start|top"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="5"
|
||||
android:maxLines="10"
|
||||
android:hint="@string/description"
|
||||
android:ellipsize="end" />
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/created" />
|
||||
<EditText
|
||||
android:id="@+id/name_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/name"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/created_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
<EditText
|
||||
android:id="@+id/description_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:gravity="start|top"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="5"
|
||||
android:maxLines="10"
|
||||
android:hint="@string/description"
|
||||
android:ellipsize="end" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/modified" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/created" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/modified_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
<TextView
|
||||
android:id="@+id/created_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/category" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/modified" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
<TextView
|
||||
android:id="@+id/modified_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/coords"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/category" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coords_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
<TextView
|
||||
android:id="@+id/category_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accuracy_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/accuracy"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@android:color/darker_gray"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/coords"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit_bt"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="50dp"
|
||||
android:text="@string/confirm"
|
||||
app:backgroundTint="@color/defaultBrand"
|
||||
android:onClick="onSubmit"/>
|
||||
<TextView
|
||||
android:id="@+id/coords_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accuracy_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/accuracy"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@android:color/darker_gray"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit_bt"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="50dp"
|
||||
android:text="@string/confirm"
|
||||
app:backgroundTint="@color/defaultBrand"
|
||||
android:onClick="onSubmit"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<!-- Back button -->
|
||||
<ImageView
|
||||
android:id="@+id/back_bt"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_back_grey"
|
||||
app:tint="@color/white"
|
||||
android:background="@color/defaultBrandAlpha"/>
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Nextcloud Maps Geofavorites for Android
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_list_view"
|
||||
android:background="@color/primary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:toolbarId="@+id/toolbar" >
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:titleMarginStart="0dp"
|
||||
tools:title="@string/app_name">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/search_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</androidx.appcompat.widget.SearchView>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/home_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacer_2x"
|
||||
android:layout_marginTop="@dimen/spacer_1hx"
|
||||
android:layout_marginEnd="@dimen/spacer_2x"
|
||||
android:layout_marginBottom="@dimen/spacer_1hx"
|
||||
app:cardBackgroundColor="@color/appbar"
|
||||
app:cardCornerRadius="@dimen/spacer_1x"
|
||||
app:cardElevation="2dp"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/menu_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:paddingStart="@dimen/spacer_1x"
|
||||
android:paddingTop="@dimen/spacer_2x"
|
||||
android:paddingEnd="@dimen/spacer_1x"
|
||||
android:paddingBottom="@dimen/spacer_2x"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:src="@drawable/ic_menu_grey"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/search_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/spacer_1x"
|
||||
android:layout_marginEnd="@dimen/spacer_1x"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start"
|
||||
android:lines="1"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/search_in_all"/>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sort_mode"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/list_mode"
|
||||
android:padding="@dimen/spacer_2x"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:translationX="@dimen/spacer_1x"
|
||||
android:src="@drawable/ic_alphabetical_asc" />
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/view_mode"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/list_mode"
|
||||
android:padding="@dimen/spacer_2x"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:translationX="@dimen/spacer_1x"
|
||||
android:src="@drawable/ic_view_module" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/spacer_1hx"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:spanCount="1"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_geofav">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/add"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_add"
|
||||
app:backgroundTint="@color/defaultBrand"/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -26,12 +26,126 @@
|
||||
tools:openDrawer="start"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
<include layout="@layout/activity_list_view"
|
||||
android:id="@+id/activity_list_view"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/primary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/root">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:toolbarId="@+id/toolbar" >
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:titleMarginStart="0dp"
|
||||
tools:title="@string/app_name">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/search_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</androidx.appcompat.widget.SearchView>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/home_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacer_2x"
|
||||
android:layout_marginTop="@dimen/spacer_1hx"
|
||||
android:layout_marginEnd="@dimen/spacer_2x"
|
||||
android:layout_marginBottom="@dimen/spacer_1hx"
|
||||
app:cardBackgroundColor="@color/appbar"
|
||||
app:cardCornerRadius="@dimen/spacer_1x"
|
||||
app:cardElevation="2dp"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/menu_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:paddingStart="@dimen/spacer_1x"
|
||||
android:paddingTop="@dimen/spacer_2x"
|
||||
android:paddingEnd="@dimen/spacer_1x"
|
||||
android:paddingBottom="@dimen/spacer_2x"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:src="@drawable/ic_menu_grey"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/search_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/spacer_1x"
|
||||
android:layout_marginEnd="@dimen/spacer_1x"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start"
|
||||
android:lines="1"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/search_in_all"/>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sort_mode"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/list_mode"
|
||||
android:padding="@dimen/spacer_2x"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:translationX="@dimen/spacer_1x"
|
||||
android:src="@drawable/ic_alphabetical_asc" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_container"
|
||||
android:name="it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</androidx.fragment.app.FragmentContainerView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/add"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_add"
|
||||
app:backgroundTint="@color/defaultBrand"/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<!-- TODO: Is use another layout for that is fill screen. -->
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
55
app/src/main/res/layout/fragment_geofavorite_list.xml
Normal file
55
app/src/main/res/layout/fragment_geofavorite_list.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Nextcloud Maps Geofavorites for Android
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/spacer_1hx"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:spanCount="1"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_geofav">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
14
app/src/main/res/layout/fragment_map.xml
Normal file
14
app/src/main/res/layout/fragment_map.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragments.MapFragment">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Map fragment" />
|
||||
|
||||
</FrameLayout>
|
@ -22,9 +22,13 @@
|
||||
<color name="accent">#121212</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="defaultBrand">#0082C9</color>
|
||||
<color name="defaultBrandAlpha">#550082C9</color>
|
||||
<color name="appbar">@android:color/white</color>
|
||||
<color name="defaultTint">#202124</color>
|
||||
|
||||
<!-- List Colors -->
|
||||
<color name="list_text">#aaa</color>
|
||||
|
||||
<!-- Generic Colors -->
|
||||
<color name="white">#fff</color>
|
||||
</resources>
|
@ -81,6 +81,5 @@
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="setting_sort_by">SETTING_SORT_BY</string>
|
||||
<string name="setting_grid_view_enabled">SETTING_GRID_VIEW_ENABLED</string>
|
||||
|
||||
</resources>
|
||||
|
@ -25,7 +25,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
BIN
screenshots/1.png
Normal file
BIN
screenshots/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
screenshots/2.png
Normal file
BIN
screenshots/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
Reference in New Issue
Block a user