Skip to content

Commit

Permalink
initials
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhawak committed Jan 9, 2023
1 parent 25bf0b4 commit c1c7bcf
Show file tree
Hide file tree
Showing 45 changed files with 981 additions and 194 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added app/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ dependencies {
// AndroidX Capable version
implementation 'com.github.AppIntro:AppIntro:6.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.github.YarikSOffice:lingver:1.3.0'


}
Expand Down
Binary file added app/src/.DS_Store
Binary file not shown.
Binary file added app/src/main/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".App"
android:description="@string/app_description"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/net/osmtracker/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.osmtracker;

import android.app.Application;
import android.content.res.Resources;
import android.os.Build;


import com.yariksoffice.lingver.Lingver;
import com.yariksoffice.lingver.store.PreferenceLocaleStore;

import java.util.Locale;

public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
Locale language = new Locale("xx", "Cap");
Locale locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
locale = Resources.getSystem().getConfiguration().getLocales().get(0);
} else {
//noinspection deprecation
locale = Resources.getSystem().getConfiguration().locale;
}
Lingver.init(this, new PreferenceLocaleStore(this, language));
}
}
2 changes: 2 additions & 0 deletions app/src/main/java/net/osmtracker/OSMTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static final class Preferences {
public final static String KEY_UI_DISPLAY_KEEP_ON = "ui.display_keep_on";
public final static String KEY_UI_MAP_TILE = "ui.map.tile";
public final static String KEY_SOUND_ENABLED = "sound_enabled";
public final static String KEY_NEPALI_ENABLED = "nepali_enabled";
public final static String KEY_UI_ORIENTATION = "ui.orientation";
public final static String KEY_OSM_OAUTH_TOKEN = "osm.oauth.token";
public final static String KEY_OSM_OAUTH_SECRET = "osm.oauth.secret";
Expand Down Expand Up @@ -88,6 +89,7 @@ public static final class Preferences {
public final static boolean VAL_UI_DISPLAYTRACK_OSM = false;
public final static boolean VAL_UI_DISPLAY_KEEP_ON = true;
public final static boolean VAL_SOUND_ENABLED = true;
public final static boolean VAL_NEPALI_ENABLED = false;
public final static String VAL_UI_ORIENTATION_NONE = "none";
public final static String VAL_UI_ORIENTATION_PORTRAIT = "portrait";
public final static String VAL_UI_ORIENTATION_LANDSCAPE = "landscape";
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/java/net/osmtracker/activity/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.FilenameFilter;
import java.util.Locale;

import net.osmtracker.OSMTracker;
import net.osmtracker.R;
Expand All @@ -12,6 +13,9 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;

Expand All @@ -25,9 +29,13 @@
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;

import com.yariksoffice.lingver.Lingver;


/**
* Manages preferences screen.
Expand Down Expand Up @@ -175,6 +183,37 @@ public boolean onPreferenceClick(Preference preference) {
return true;
}
});
pref = findPreference(OSMTracker.Preferences.KEY_NEPALI_ENABLED);

pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
boolean vals = prefs.getBoolean(OSMTracker.Preferences.KEY_NEPALI_ENABLED, OSMTracker.Preferences.VAL_NEPALI_ENABLED);
if (vals) {
Locale language = new Locale("xx", "Cap");
Lingver.getInstance().setLocale(getApplicationContext(), language);
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
finish();
} else {
Locale locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
locale = Resources.getSystem().getConfiguration().getLocales().get(0);
} else {
//noinspection deprecation
locale = Resources.getSystem().getConfiguration().locale;
}
Lingver.getInstance().setLocale(getApplicationContext(), locale);
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
finish();
}
Log.wtf("Lang", String.valueOf(vals));
return false;
}
});

// Button screen orientation option
pref = findPreference(OSMTracker.Preferences.KEY_UI_ORIENTATION);
Expand Down
27 changes: 19 additions & 8 deletions app/src/main/java/net/osmtracker/activity/TrackLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.io.File;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashSet;

Expand Down Expand Up @@ -40,6 +42,8 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.LocationManager;
import android.media.AudioManager;
import android.net.Uri;
Expand Down Expand Up @@ -601,7 +605,7 @@ public void requestStillImage() {

AlertDialog.Builder getImageFrom = new AlertDialog.Builder(TrackLogger.this);
getImageFrom.setTitle("Select:");
final CharSequence[] opsChars = { getString(R.string.tracklogger_camera), getString(R.string.tracklogger_gallery) };
final CharSequence[] opsChars = { getString(R.string.tracklogger_camera) };
getImageFrom.setItems(opsChars, new android.content.DialogInterface.OnClickListener() {

@Override
Expand Down Expand Up @@ -648,13 +652,20 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// An image has been selected from the gallery, track the corresponding waypoint
File imageFile = popImageFile();
if (imageFile != null) {
// Copy the file from the gallery
Cursor c = getContentResolver().query(data.getData(), null, null, null, null);
c.moveToFirst();
String f = c.getString(c.getColumnIndex(ImageColumns.DATA));
c.close();
Log.d(TAG, "Copying gallery file '"+f+"' into '"+imageFile+"'");
FileSystemUtils.copyFile(imageFile.getParentFile(), new File(f), imageFile.getName());
// Needed to be fixed later
if (Build.VERSION.SDK_INT >= 19) {
// Uri photoUri = data.getData();
// FileSystemUtils.copyFile(imageFile.getParentFile(), new File(photoUri.getPath()), imageFile.getName());
}
else {
// Copy the file from the gallery
Cursor c = getContentResolver().query(data.getData(), null, null, null, null);
c.moveToFirst();
String f = c.getString(c.getColumnIndex(ImageColumns.DATA));
c.close();
Log.d(TAG, "Copying gallery file '" + f + "' into '" + imageFile + "'");
FileSystemUtils.copyFile(imageFile.getParentFile(), new File(f), imageFile.getName());
}

// Send an intent to inform service to track the waypoint.
Intent intent = new Intent(OSMTracker.INTENT_TRACK_WP);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/net/osmtracker/activity/TrackManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.yariksoffice.lingver.Lingver;

import net.osmtracker.OSMTracker;
import net.osmtracker.R;
Expand All @@ -43,6 +44,7 @@

import java.io.File;
import java.util.Date;
import java.util.Locale;

/**
* Lists existing tracks. Each track is displayed using {@link RecyclerView}
Expand Down Expand Up @@ -89,7 +91,6 @@ public class TrackManager extends AppCompatActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.trackmanager);

Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/net/osmtracker/db/WaypointListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

import net.osmtracker.R;
Expand All @@ -26,7 +27,7 @@ public class WaypointListAdapter extends CursorAdapter {
/**
* Date formatter
*/
public static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("HH:mm:ss 'UTC'");
public static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("HH:mm:ss 'UTC'", Locale.ENGLISH);
static {
DATE_FORMATTER.setTimeZone(TimeZone.getTimeZone("UTC"));
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/net/osmtracker/gpx/ExportTrackTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -80,7 +81,7 @@ public abstract class ExportTrackTask extends AsyncTask<Void, Long, Boolean> {
/**
* Date format for a point timestamp.
*/
private SimpleDateFormat pointDateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
private SimpleDateFormat pointDateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);

/**
* {@link Context} to get resources
Expand Down
Binary file added app/src/main/res/.DS_Store
Binary file not shown.
Binary file added app/src/main/res/drawable-mdpi/.DS_Store
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/bin_recycle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/bin_segregate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/care.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/covered_well.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/dumping_site.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grade1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grade2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grade3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grade4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grade5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/hand_pump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/river.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/spring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/tap_water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/track.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/village.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/waste_land.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/waste_outlet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/waste_water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c1c7bcf

Please sign in to comment.