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,16 +57,15 @@ 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() {
|
||||||
super.onPause();
|
super.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) {
|
||||||
|
|
|
@ -29,9 +29,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
|
|
||||||
@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,
|
||||||
|
false);
|
||||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||||
final TextView message =((TextView) view.findViewById(R.id.message));
|
final TextView message = ((TextView) view.findViewById(R.id.message));
|
||||||
message.setTypeface(typeface);
|
message.setTypeface(typeface);
|
||||||
|
|
||||||
Button local = ((Button) view.findViewById(R.id.local_downloads));
|
Button local = ((Button) view.findViewById(R.id.local_downloads));
|
||||||
|
@ -39,9 +40,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
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);
|
getActivity().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -51,9 +53,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
cancelBtn.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.DOWNLOAD_TAB);
|
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
|
||||||
//intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
// intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
||||||
getActivity().startActivity(intent);
|
getActivity().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -61,21 +64,21 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,8 +22,7 @@ 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 {
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ public class DashErrorFragment extends DashBaseFragment {
|
||||||
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));
|
||||||
|
@ -57,7 +56,8 @@ public class DashErrorFragment extends DashBaseFragment {
|
||||||
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(),
|
||||||
|
0);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
|
text.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
@ -73,12 +73,17 @@ public class DashErrorFragment extends DashBaseFragment {
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue