Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
ae37f14067 | |||
c7212fbeba | |||
f21e5221ba | |||
fdb314c48b | |||
b8541c994a | |||
2a62da3cf2 | |||
7c5de6ccd7 | |||
4ff6c569d0 | |||
c58041fc20 | |||
b3169f6525 |
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@ -4,6 +4,11 @@
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../../../layout/custom_preview.xml" value="0.5661458333333333" />
|
||||
<entry key="app/src/main/res/drawable/floating_semitransparent_button_background.xml" value="0.512962962962963" />
|
||||
<entry key="app/src/main/res/drawable/ic_map_pin.xml" value="0.6425925925925926" />
|
||||
<entry key="app/src/main/res/drawable/ic_more.xml" value="0.6166666666666667" />
|
||||
<entry key="app/src/main/res/drawable/ic_nav.xml" value="0.6083333333333333" />
|
||||
<entry key="app/src/main/res/drawable/ic_share.xml" value="0.8828125" />
|
||||
<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" />
|
||||
|
@ -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)
|
||||
|
||||
|
@ -24,8 +24,8 @@ android {
|
||||
applicationId "it.danieleverducci.nextcloudmaps"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
versionCode 2
|
||||
versionName "0.2"
|
||||
versionCode 3
|
||||
versionName "0.3.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -55,15 +55,15 @@ 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"
|
||||
|
||||
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 +71,11 @@ dependencies {
|
||||
|
||||
// Nextcloud SSO
|
||||
implementation "com.github.nextcloud:Android-SingleSignOn:0.5.6"
|
||||
|
||||
// OSMDroid
|
||||
implementation 'org.osmdroid:osmdroid-android:6.1.10'
|
||||
|
||||
//Threeten-Backport (ports Java 8 Date API on Java 6+)
|
||||
implementation 'org.threeten:threetenbp:1.5.1'
|
||||
|
||||
}
|
||||
|
@ -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"
|
||||
]
|
||||
}
|
@ -19,6 +19,7 @@ package it.danieleverducci.nextcloudmaps.activity.detail;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
@ -34,14 +35,26 @@ 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 org.threeten.bp.format.DateTimeFormatter;
|
||||
import org.threeten.bp.format.FormatStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.R;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.MainActivity;
|
||||
import it.danieleverducci.nextcloudmaps.api.ApiProvider;
|
||||
import it.danieleverducci.nextcloudmaps.databinding.ActivityGeofavoriteDetailBinding;
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
import it.danieleverducci.nextcloudmaps.utils.IntentGenerator;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@ -61,9 +74,43 @@ 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 onActionIconShareClicked() {
|
||||
startActivity(Intent.createChooser(IntentGenerator.newShareIntent(GeofavoriteDetailActivity.this, mGeofavorite), getString(R.string.share_via)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionIconNavClicked() {
|
||||
startActivity(IntentGenerator.newGeoUriIntent(GeofavoriteDetailActivity.this, mGeofavorite));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionIconDeleteClicked() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@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
|
||||
@ -75,6 +122,8 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
mGeofavorite.setCategory(DEFAULT_CATEGORY);
|
||||
mGeofavorite.setDateCreated(System.currentTimeMillis());
|
||||
mGeofavorite.setDateModified(System.currentTimeMillis());
|
||||
mViewHolder.hideActions();
|
||||
|
||||
// Precompile location
|
||||
getLocation();
|
||||
}
|
||||
@ -83,6 +132,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 +233,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());
|
||||
}
|
||||
|
||||
@ -210,11 +277,28 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
|
||||
private class ViewHolder implements View.OnClickListener {
|
||||
private final ActivityGeofavoriteDetailBinding binding;
|
||||
private DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG);
|
||||
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);
|
||||
this.binding.actionIconShare.setOnClickListener(this);
|
||||
this.binding.actionIconDelete.setOnClickListener(this);
|
||||
this.binding.actionIconNav.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() {
|
||||
@ -222,16 +306,26 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
}
|
||||
|
||||
public void updateView(Geofavorite item) {
|
||||
binding.collapsingToolbar.setTitle(item.getName() != null ? item.getName() : getString(R.string.new_geobookmark));
|
||||
binding.nameEt.setText(item.getName());
|
||||
binding.descriptionEt.setText(item.getComment());
|
||||
binding.createdTv.setText(new Date(item.getDateCreated() * 1000).toString());
|
||||
binding.modifiedTv.setText(new Date(item.getDateModified() * 1000).toString());
|
||||
binding.createdTv.setText(item.getLocalDateCreated().format(dateFormatter));
|
||||
binding.modifiedTv.setText(item.getLocalDateCreated().format(dateFormatter));
|
||||
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) {
|
||||
@ -254,19 +348,53 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
|
||||
binding.accuracyTv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void hideActions() {
|
||||
binding.actionIcons.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setOnSubmitListener(OnSubmitListener listener) {
|
||||
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();
|
||||
}
|
||||
|
||||
// Actions
|
||||
if (v.getId() == R.id.action_icon_share && this.listener != null) {
|
||||
this.listener.onActionIconShareClicked();
|
||||
}
|
||||
if (v.getId() == R.id.action_icon_nav && this.listener != null) {
|
||||
this.listener.onActionIconNavClicked();
|
||||
}
|
||||
if (v.getId() == R.id.action_icon_delete && this.listener != null) {
|
||||
this.listener.onActionIconDeleteClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected interface OnSubmitListener {
|
||||
void onSubmit();
|
||||
void onMapClicked();
|
||||
void onBackPressed();
|
||||
void onActionIconShareClicked();
|
||||
void onActionIconNavClicked();
|
||||
void onActionIconDeleteClicked();
|
||||
}
|
||||
}
|
||||
|
@ -21,13 +21,9 @@
|
||||
package it.danieleverducci.nextcloudmaps.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -40,6 +36,9 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.threeten.bp.format.DateTimeFormatter;
|
||||
import org.threeten.bp.format.FormatStyle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -57,6 +56,7 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
private DateTimeFormatter dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT);
|
||||
|
||||
private List<Geofavorite> geofavoriteList = new ArrayList<>();
|
||||
private List<Geofavorite> geofavoriteListFiltered = new ArrayList<>();
|
||||
@ -117,6 +117,7 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
|
||||
holder.tv_title.setText(Html.fromHtml(geofavorite.getName()));
|
||||
holder.tv_content.setText(geofavorite.getComment());
|
||||
holder.tv_date.setText(geofavorite.getLocalDateCreated().format(dateFormatter));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -164,9 +165,9 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
};
|
||||
|
||||
class GeofavoriteViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView tv_title, tv_content;
|
||||
TextView tv_title, tv_content, tv_date;
|
||||
ImageView bt_context_menu;
|
||||
ImageView bt_share;
|
||||
ImageView bt_nav;
|
||||
|
||||
ItemClickListener itemClickListener;
|
||||
|
||||
@ -176,14 +177,15 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
|
||||
tv_title = itemView.findViewById(R.id.title);
|
||||
tv_content = itemView.findViewById(R.id.content);
|
||||
tv_date = itemView.findViewById(R.id.date);
|
||||
bt_context_menu = itemView.findViewById(R.id.geofav_context_menu_bt);
|
||||
bt_share = itemView.findViewById(R.id.geofav_share_bt);
|
||||
bt_nav = itemView.findViewById(R.id.geofav_nav_bt);
|
||||
|
||||
this.itemClickListener = itemClickListener;
|
||||
itemView.setOnClickListener(this);
|
||||
|
||||
bt_context_menu.setOnClickListener(this);
|
||||
bt_share.setOnClickListener(this);
|
||||
bt_nav.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -192,9 +194,9 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
case R.id.geofav_context_menu_bt:
|
||||
onOverflowIconClicked(view, getAdapterPosition());
|
||||
break;
|
||||
case R.id.geofav_share_bt:
|
||||
case R.id.geofav_nav_bt:
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemShareClick(get(getAdapterPosition()));
|
||||
itemClickListener.onItemNavClick(get(getAdapterPosition()));
|
||||
break;
|
||||
default:
|
||||
if (itemClickListener != null)
|
||||
@ -229,9 +231,9 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
}
|
||||
Geofavorite gf = get(overflowMenuSelectedPosition);
|
||||
overflowMenuSelectedPosition = -1;
|
||||
if (item.getItemId() == R.id.list_context_menu_detail && itemClickListener != null)
|
||||
itemClickListener.onItemDetailsClick(gf);
|
||||
if (item.getItemId() == R.id.list_context_menu_delete)
|
||||
if (item.getItemId() == R.id.list_context_menu_share && itemClickListener != null)
|
||||
itemClickListener.onItemShareClick(gf);
|
||||
if (item.getItemId() == R.id.list_context_menu_delete && itemClickListener != null)
|
||||
itemClickListener.onItemDeleteClick(gf);
|
||||
return true;
|
||||
}
|
||||
@ -239,7 +241,7 @@ public class GeofavoriteAdapter extends RecyclerView.Adapter<GeofavoriteAdapter.
|
||||
public interface ItemClickListener {
|
||||
void onItemClick(Geofavorite item);
|
||||
void onItemShareClick(Geofavorite item);
|
||||
void onItemDetailsClick(Geofavorite item);
|
||||
void onItemNavClick(Geofavorite item);
|
||||
void onItemDeleteClick(Geofavorite item);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ import it.danieleverducci.nextcloudmaps.activity.login.LoginActivity;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.NavigationAdapter.NavigationItem;
|
||||
import it.danieleverducci.nextcloudmaps.activity.main.SortingOrderDialogFragment.OnSortingOrderListener;
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
import it.danieleverducci.nextcloudmaps.utils.IntentGenerator;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
@ -107,28 +108,18 @@ public class MainActivity extends AppCompatActivity implements MainView, OnSorti
|
||||
|
||||
rvItemClickListener = new ItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(Geofavorite geofavorite) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_VIEW);
|
||||
i.setData(geofavorite.getGeoUri());
|
||||
startActivity(i);
|
||||
public void onItemClick(Geofavorite item) {
|
||||
showGeofavoriteDetailActivity(item);
|
||||
}
|
||||
|
||||
@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)));
|
||||
startActivity(Intent.createChooser(IntentGenerator.newShareIntent(MainActivity.this, item), getString(R.string.share_via)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDetailsClick(Geofavorite item) {
|
||||
showGeofavoriteDetailActivity(item);
|
||||
public void onItemNavClick(Geofavorite item) {
|
||||
startActivity(IntentGenerator.newGeoUriIntent(MainActivity.this, item));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,6 +32,10 @@ import androidx.databinding.BindingAdapter;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.threeten.bp.Instant;
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.ZoneId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
@ -102,10 +106,17 @@ public class Geofavorite implements Serializable {
|
||||
public void setDateModified(long dateModified) {
|
||||
this.dateModified = dateModified;
|
||||
}
|
||||
public LocalDate getLocalDateModified() {
|
||||
return Instant.ofEpochSecond(getDateCreated()).atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
}
|
||||
|
||||
public long getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
public LocalDate getLocalDateCreated() {
|
||||
return Instant.ofEpochSecond(getDateCreated()).atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
}
|
||||
|
||||
public void setDateCreated(long dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package it.danieleverducci.nextcloudmaps.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import it.danieleverducci.nextcloudmaps.R;
|
||||
import it.danieleverducci.nextcloudmaps.model.Geofavorite;
|
||||
|
||||
public class IntentGenerator {
|
||||
public static Intent newShareIntent(Context context, Geofavorite item) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_SEND);
|
||||
i.setType("text/plain");
|
||||
String shareMessage = context.getString(R.string.share_message)
|
||||
.replace("{lat}", ""+item.getLat())
|
||||
.replace("{lng}", ""+item.getLng());
|
||||
i.putExtra(Intent.EXTRA_TEXT, shareMessage );
|
||||
return i;
|
||||
}
|
||||
|
||||
public static Intent newGeoUriIntent(Context context, Geofavorite item) {
|
||||
Intent i = new Intent();
|
||||
i.setAction(Intent.ACTION_VIEW);
|
||||
i.setData(item.getGeoUri());
|
||||
return i;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:left="8dp"
|
||||
android:right="8dp"
|
||||
android:top="8dp"
|
||||
android:bottom="8dp">
|
||||
<shape
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/defaultBrandAlpha"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
5
app/src/main/res/drawable/ic_edit.xml
Normal file
5
app/src/main/res/drawable/ic_edit.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#0082C9"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
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>
|
10
app/src/main/res/drawable/ic_nav.xml
Normal file
10
app/src/main/res/drawable/ic_nav.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
|
||||
</vector>
|
@ -2,23 +2,74 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ScrollView
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/root">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="250dp"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/map"
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
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"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="@color/defaultBrand"
|
||||
app:layout_scrollFlags="scroll|snap|exitUntilCollapsed"
|
||||
app:title="@string/new_geobookmark"
|
||||
app:expandedTitleTextAppearance="@style/TextAppearance.GeofavoriteDetail.Header.Expanded"
|
||||
app:collapsedTitleTextAppearance="@style/TextAppearance.GeofavoriteDetail.Header.Collapsed">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_collapseMode="parallax">
|
||||
<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>
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:contentInsetStart="0dp"
|
||||
app:layout_collapseMode="pin"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<!-- Back button -->
|
||||
<ImageView
|
||||
android:id="@+id/back_bt"
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_back_grey"
|
||||
app:tint="@color/white"
|
||||
android:background="@drawable/floating_semitransparent_button_background"/>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -26,33 +77,87 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<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"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/action_icons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/action_icon_share"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_share"
|
||||
android:tint="@color/defaultBrand"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/action_icon_nav"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_nav"
|
||||
android:tint="@color/defaultBrand"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/action_icon_delete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_delete_grey"
|
||||
android:tint="@color/defaultBrand"
|
||||
android:visibility="gone"/> <!-- TODO Implement delete -->
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/name"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"/>
|
||||
android:textColor="@color/defaultBrand"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawableLeft="@drawable/ic_edit"
|
||||
android:drawablePadding="5dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:ems="10"
|
||||
android:gravity="start|top"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="5"
|
||||
android:maxLines="10"
|
||||
android:hint="@string/description"
|
||||
android:ellipsize="end" />
|
||||
android:background="@android:color/transparent"
|
||||
android:drawableLeft="@drawable/ic_edit"
|
||||
android:drawablePadding="5dp"
|
||||
android:hint="@string/description"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/created" />
|
||||
|
||||
@ -101,16 +206,6 @@
|
||||
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"
|
||||
@ -123,6 +218,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</layout>
|
@ -23,13 +23,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:contentDescription="@null"
|
||||
android:layout_weight="0"
|
||||
android:src="@mipmap/ic_launcher"/>
|
||||
|
||||
@ -37,51 +38,76 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/note_font_size_item_title"
|
||||
android:textStyle="bold"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1"
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
android:ellipsize="middle"
|
||||
android:textColor="@color/text_color"
|
||||
android:textSize="@dimen/two_line_primary_text_size"
|
||||
tools:text="@tools:sample/lorem/random">
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="@dimen/note_font_size_item_content"
|
||||
android:maxLines="2"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="@tools:sample/lorem/random">
|
||||
</TextView>
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textColor="@color/secondary_text_color"
|
||||
android:textSize="@dimen/two_line_secondary_text_size"
|
||||
android:maxLines="1"
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="@tools:sample/lorem/random">
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:textColor="@color/secondary_text_color"
|
||||
android:textSize="@dimen/two_line_secondary_text_size"
|
||||
android:maxLines="1"
|
||||
android:lines="1"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="00/00/0000">
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/geofav_share_bt"
|
||||
android:id="@+id/geofav_nav_bt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_share"
|
||||
android:tint="@color/list_text" /> <!-- TODO: app:tint is not working -->
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_nav"
|
||||
android:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/geofav_context_menu_bt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:padding="10dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_more"
|
||||
android:tint="@color/list_text" /> <!-- TODO: app:tint is not working -->
|
||||
android:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
|
||||
|
||||
</LinearLayout>
|
@ -1,10 +1,10 @@
|
||||
<?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">
|
||||
<!-- Detail button -->
|
||||
<!-- Share button -->
|
||||
<item
|
||||
android:id="@+id/list_context_menu_detail"
|
||||
android:title="@string/list_context_menu_detail"/>
|
||||
android:id="@+id/list_context_menu_share"
|
||||
android:title="@string/list_context_menu_share"/>
|
||||
<!-- Delete button -->
|
||||
<item
|
||||
android:id="@+id/list_context_menu_delete"
|
||||
|
@ -22,9 +22,14 @@
|
||||
<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>
|
||||
<color name="text_color">#333333</color>
|
||||
<color name="secondary_text_color">#666666</color>
|
||||
|
||||
<!-- Generic Colors -->
|
||||
<color name="white">#fff</color>
|
||||
</resources>
|
@ -28,14 +28,12 @@
|
||||
<dimen name="drawer_header_logo_size">42dp</dimen>
|
||||
|
||||
<!-- Font Sizes -->
|
||||
<dimen name="note_font_size_item_title">18sp</dimen>
|
||||
<dimen name="note_font_size_item_content">14sp</dimen>
|
||||
|
||||
<dimen name="zero">0dp</dimen>
|
||||
<dimen name="standard_margin">16dp</dimen>
|
||||
<dimen name="standard_half_margin">8dp</dimen>
|
||||
<dimen name="standard_padding">16dp</dimen>
|
||||
<dimen name="standard_half_padding">8dp</dimen>
|
||||
<dimen name="two_line_primary_text_size">16sp</dimen>
|
||||
<dimen name="two_line_secondary_text_size">12sp</dimen>
|
||||
|
||||
</resources>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<string name="search_in_all">Search by name</string>
|
||||
<string name="share_via">Share via</string>
|
||||
<string name="share_message">Check out this place: {lat}°N, {lng}°E https://www.openstreetmap.org/#map=17/{lat}/{lng}</string>
|
||||
<string name="list_context_menu_detail">Details</string>
|
||||
<string name="list_context_menu_share">Share</string>
|
||||
<string name="list_context_menu_delete">Delete</string>
|
||||
<string name="dialog_delete_title">Delete geobookmark</string>
|
||||
<string name="dialog_delete_message">You are about to delete geobookmark {name}. Proceed?</string>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<style name="BaseTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<!-- <item name="android:textColorPrimary">@color/white</item>-->
|
||||
<item name="colorPrimaryDark">@color/primary</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="android:actionModeBackground">?attr/colorPrimary</item>
|
||||
@ -48,4 +49,15 @@
|
||||
<item name="android:background">?attr/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<!-- Geofavorite detail text appearances -->
|
||||
|
||||
<style name="TextAppearance.GeofavoriteDetail.Header.Expanded" parent="TextAppearance.Design.CollapsingToolbar.Expanded">
|
||||
<item name="android:textSize">36sp</item>
|
||||
<item name="android:textColor">@color/defaultBrand</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.GeofavoriteDetail.Header.Collapsed" parent="TextAppearance.AppCompat.Title">
|
||||
<item name="android:textColor">@color/white</item>
|
||||
</style>
|
||||
|
||||
</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 |
BIN
screenshots/full/1.png
Normal file
BIN
screenshots/full/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
BIN
screenshots/full/1_tablet.png
Normal file
BIN
screenshots/full/1_tablet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
BIN
screenshots/full/2.png
Normal file
BIN
screenshots/full/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
BIN
screenshots/full/2_tablet.png
Normal file
BIN
screenshots/full/2_tablet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
Reference in New Issue
Block a user