Fix errors
This commit is contained in:
parent
f577beaae6
commit
62f3a55deb
6 changed files with 111 additions and 113 deletions
|
@ -5,7 +5,7 @@
|
||||||
/>
|
/>
|
||||||
<Preference android:key="general_settings" android:title="@string/general_settings_2" android:summary="@string/general_settings_descr"/>
|
<Preference android:key="general_settings" android:title="@string/general_settings_2" android:summary="@string/general_settings_descr"/>
|
||||||
<Preference android:key="routing_settings" android:title="@string/routing_settings_2" android:summary="@string/routing_settings_descr"/>
|
<Preference android:key="routing_settings" android:title="@string/routing_settings_2" android:summary="@string/routing_settings_descr"/>
|
||||||
<Preference android:title="@string/tips_and_tricks" android:summary="@string/tips_and_tricks_descr" android:key="help"
|
<Preference android:title="@string/shared_string_help" android:summary="@string/tips_and_tricks_descr" android:key="help"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- <Preference android:title="@string/support_new_features" android:summary="@string/support_new_features_descr" android:key="bidforfix"/> -->
|
<!-- <Preference android:title="@string/support_new_features" android:summary="@string/support_new_features_descr" android:key="bidforfix"/> -->
|
||||||
|
|
|
@ -38,12 +38,10 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
|
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
|
||||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||||
|
|
||||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -59,15 +57,14 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onOpenUpdate() {
|
||||||
super.onResume();
|
|
||||||
if (plugin == null) {
|
if (plugin == null) {
|
||||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
}
|
}
|
||||||
setupNotes();
|
setupNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
|
|
@ -29,9 +29,7 @@ public abstract class DashBaseFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenUpdate() {
|
public void onOpenUpdate() {}
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void onLocationCompassChanged(Location l, double compassValue) {
|
public void onLocationCompassChanged(Location l, double compassValue) {
|
||||||
|
|
|
@ -23,59 +23,62 @@ import android.widget.TextView;
|
||||||
*/
|
*/
|
||||||
public class DashDownloadMapsFragment extends DashBaseFragment {
|
public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
public static final String TAG = "DASH_DOWNLOAD_MAPS_FRAGMENT";
|
public static final String TAG = "DASH_DOWNLOAD_MAPS_FRAGMENT";
|
||||||
MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
|
MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
|
||||||
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
|
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final View view = getActivity().getLayoutInflater().inflate(R.layout.dash_download_maps_fragment, container, false);
|
final View view = getActivity().getLayoutInflater().inflate(R.layout.dash_download_maps_fragment, container,
|
||||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
false);
|
||||||
final TextView message =((TextView) view.findViewById(R.id.message));
|
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||||
message.setTypeface(typeface);
|
final TextView message = ((TextView) view.findViewById(R.id.message));
|
||||||
|
message.setTypeface(typeface);
|
||||||
|
|
||||||
Button local = ((Button) view.findViewById(R.id.local_downloads));
|
Button local = ((Button) view.findViewById(R.id.local_downloads));
|
||||||
local.setTypeface(typeface);
|
local.setTypeface(typeface);
|
||||||
local.setOnClickListener(new View.OnClickListener() {
|
local.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
final Intent intent = new Intent(view.getContext(), getMyApplication().getAppCustomization().getDownloadIndexActivity());
|
final Intent intent = new Intent(view.getContext(), getMyApplication().getAppCustomization()
|
||||||
|
.getDownloadIndexActivity());
|
||||||
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.LOCAL_TAB);
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.LOCAL_TAB);
|
||||||
//intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
// intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
||||||
getActivity().startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Button cancelBtn = ((Button) view.findViewById(R.id.download_new_map));
|
|
||||||
cancelBtn.setTypeface(typeface);
|
|
||||||
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
final Intent intent = new Intent(view.getContext(), getMyApplication().getAppCustomization().getDownloadIndexActivity());
|
|
||||||
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
|
||||||
//intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
|
||||||
getActivity().startActivity(intent);
|
getActivity().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return view;
|
|
||||||
}
|
Button cancelBtn = ((Button) view.findViewById(R.id.download_new_map));
|
||||||
|
cancelBtn.setTypeface(typeface);
|
||||||
|
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent intent = new Intent(view.getContext(), getMyApplication().getAppCustomization()
|
||||||
|
.getDownloadIndexActivity());
|
||||||
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||||
|
// intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
||||||
|
getActivity().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onOpenUpdate() {
|
||||||
super.onResume();
|
|
||||||
refreshData();
|
refreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshData() {
|
public void refreshData() {
|
||||||
if (getView() == null){
|
if (getView() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextView message =((TextView) getView().findViewById(R.id.message));
|
final TextView message = ((TextView) getView().findViewById(R.id.message));
|
||||||
final Button local = ((Button) getView().findViewById(R.id.local_downloads));
|
final Button local = ((Button) getView().findViewById(R.id.local_downloads));
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
int countMaps = 0;
|
int countMaps = 0;
|
||||||
long size = 0;
|
long size = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
updateCount(IndexConstants.MAPS_PATH);
|
updateCount(IndexConstants.MAPS_PATH);
|
||||||
|
@ -84,8 +87,7 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateCount(String s) {
|
protected void updateCount(String s) {
|
||||||
if (!DashDownloadMapsFragment.this.isAdded() ||
|
if (!DashDownloadMapsFragment.this.isAdded() || getMyApplication() == null) {
|
||||||
getMyApplication() == null){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File ms = getMyApplication().getAppPath(s);
|
File ms = getMyApplication().getAppPath(s);
|
||||||
|
@ -105,17 +107,15 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
if (!DashDownloadMapsFragment.this.isAdded()
|
if (!DashDownloadMapsFragment.this.isAdded() || getMyApplication() == null) {
|
||||||
|| getMyApplication() == null){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(countMaps > 0) {
|
if (countMaps > 0) {
|
||||||
long mb = 1 << 20;
|
long mb = 1 << 20;
|
||||||
long gb = 1 << 30;
|
long gb = 1 << 30;
|
||||||
String sz = size > gb ?
|
String sz = size > gb ? formatGb.format(new Object[] { (float) size / (gb) }) : formatMb
|
||||||
formatGb.format(new Object[] { (float) size / (gb) }) :
|
.format(new Object[] { (float) size / mb });
|
||||||
formatMb.format(new Object[] { (float) size / mb }) ;
|
message.setText(getString(R.string.dash_download_msg, countMaps + "") + " (" + sz + ")");
|
||||||
message.setText(getString(R.string.dash_download_msg, countMaps+"") + " (" + sz +")");
|
|
||||||
local.setVisibility(View.VISIBLE);
|
local.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
message.setText(getString(R.string.dash_download_msg_none));
|
message.setText(getString(R.string.dash_download_msg_none));
|
||||||
|
@ -123,6 +123,6 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}.execute((Void)null);
|
}.execute((Void) null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,63 +22,68 @@ import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis on 02.12.14.
|
||||||
* on 02.12.14.
|
|
||||||
*/
|
*/
|
||||||
public class DashErrorFragment extends DashBaseFragment {
|
public class DashErrorFragment extends DashBaseFragment {
|
||||||
|
|
||||||
public static final String TAG = "DASH_ERROR_FRAGMENT";
|
public static final String TAG = "DASH_ERROR_FRAGMENT";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_error_fragment, container, false);
|
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_error_fragment, container, false);
|
||||||
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
|
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
|
||||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||||
TextView message =((TextView) view.findViewById(R.id.error_header));
|
TextView message = ((TextView) view.findViewById(R.id.error_header));
|
||||||
message.setTypeface(typeface);
|
message.setTypeface(typeface);
|
||||||
message.setText(msg);
|
message.setText(msg);
|
||||||
Button errorBtn = ((Button) view.findViewById(R.id.error_btn));
|
Button errorBtn = ((Button) view.findViewById(R.id.error_btn));
|
||||||
errorBtn.setTypeface(typeface);
|
errorBtn.setTypeface(typeface);
|
||||||
errorBtn.setOnClickListener(new View.OnClickListener() {
|
errorBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "crash@osmand.net" }); //$NON-NLS-1$
|
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "crash@osmand.net" }); //$NON-NLS-1$
|
||||||
File file = getMyApplication().getAppPath(OsmandApplication.EXCEPTION_PATH);
|
File file = getMyApplication().getAppPath(OsmandApplication.EXCEPTION_PATH);
|
||||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
|
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
|
||||||
intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$
|
intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$
|
||||||
intent.putExtra(Intent.EXTRA_SUBJECT, "OsmAnd bug"); //$NON-NLS-1$
|
intent.putExtra(Intent.EXTRA_SUBJECT, "OsmAnd bug"); //$NON-NLS-1$
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("\nDevice : ").append(Build.DEVICE); //$NON-NLS-1$
|
text.append("\nDevice : ").append(Build.DEVICE); //$NON-NLS-1$
|
||||||
text.append("\nBrand : ").append(Build.BRAND); //$NON-NLS-1$
|
text.append("\nBrand : ").append(Build.BRAND); //$NON-NLS-1$
|
||||||
text.append("\nModel : ").append(Build.MODEL); //$NON-NLS-1$
|
text.append("\nModel : ").append(Build.MODEL); //$NON-NLS-1$
|
||||||
text.append("\nProduct : ").append(Build.PRODUCT); //$NON-NLS-1$
|
text.append("\nProduct : ").append(Build.PRODUCT); //$NON-NLS-1$
|
||||||
text.append("\nBuild : ").append(Build.DISPLAY); //$NON-NLS-1$
|
text.append("\nBuild : ").append(Build.DISPLAY); //$NON-NLS-1$
|
||||||
text.append("\nVersion : ").append(Build.VERSION.RELEASE); //$NON-NLS-1$
|
text.append("\nVersion : ").append(Build.VERSION.RELEASE); //$NON-NLS-1$
|
||||||
text.append("\nApp Version : ").append(Version.getAppName(getMyApplication())); //$NON-NLS-1$
|
text.append("\nApp Version : ").append(Version.getAppName(getMyApplication())); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
PackageInfo info = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
PackageInfo info = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),
|
||||||
if (info != null) {
|
0);
|
||||||
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
|
if (info != null) {
|
||||||
}
|
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
}
|
||||||
}
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, text.toString());
|
}
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
|
intent.putExtra(Intent.EXTRA_TEXT, text.toString());
|
||||||
}
|
startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Button cancelBtn = ((Button) view.findViewById(R.id.error_cancel));
|
Button cancelBtn = ((Button) view.findViewById(R.id.error_cancel));
|
||||||
cancelBtn.setTypeface(typeface);
|
cancelBtn.setTypeface(typeface);
|
||||||
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
ActionBarActivity dashboardActivity =((ActionBarActivity)getActivity());
|
ActionBarActivity dashboardActivity = ((ActionBarActivity) getActivity());
|
||||||
if (dashboardActivity != null) {
|
if (dashboardActivity != null) {
|
||||||
dashboardActivity.getSupportFragmentManager().beginTransaction().remove(DashErrorFragment.this).commit();
|
dashboardActivity.getSupportFragmentManager().beginTransaction().remove(DashErrorFragment.this)
|
||||||
}
|
.commit();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
return view;
|
});
|
||||||
}
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOpenUpdate() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import net.osmand.Location;
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
|
||||||
import net.osmand.util.MapUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Denis
|
* Created by Denis
|
||||||
* on 26.01.2015.
|
* on 26.01.2015.
|
||||||
*/
|
*/
|
||||||
public class DashLocationFragment extends DashBaseFragment {
|
public abstract class DashLocationFragment extends DashBaseFragment {
|
||||||
|
|
||||||
private static final int ORIENTATION_0 = 0;
|
private static final int ORIENTATION_0 = 0;
|
||||||
private static final int ORIENTATION_90 = 3;
|
private static final int ORIENTATION_90 = 3;
|
||||||
|
@ -74,7 +72,7 @@ public class DashLocationFragment extends DashBaseFragment {
|
||||||
|
|
||||||
direction.setImageDrawable(draw);
|
direction.setImageDrawable(draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateCompassValue(float value) {
|
public boolean updateCompassValue(float value) {
|
||||||
//heading = value;
|
//heading = value;
|
||||||
//updateArrows();
|
//updateArrows();
|
||||||
|
|
Loading…
Reference in a new issue