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="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"/> -->
|
||||
|
|
|
@ -38,12 +38,10 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -59,16 +57,15 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
public void onOpenUpdate() {
|
||||
if (plugin == null) {
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
}
|
||||
setupNotes();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
|
|
@ -29,9 +29,7 @@ public abstract class DashBaseFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void onOpenUpdate() {
|
||||
// TODO
|
||||
}
|
||||
public void onOpenUpdate() {}
|
||||
|
||||
|
||||
public void onLocationCompassChanged(Location l, double compassValue) {
|
||||
|
|
|
@ -29,9 +29,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
|
||||
@Override
|
||||
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());
|
||||
final TextView message =((TextView) view.findViewById(R.id.message));
|
||||
final TextView message = ((TextView) view.findViewById(R.id.message));
|
||||
message.setTypeface(typeface);
|
||||
|
||||
Button local = ((Button) view.findViewById(R.id.local_downloads));
|
||||
|
@ -39,9 +40,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
local.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
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.SINGLE_TAB, true);
|
||||
// intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
@ -51,9 +53,10 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
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.SINGLE_TAB, true);
|
||||
// intent.putExtra(DownloadActivity.SINGLE_TAB, true);
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
@ -61,21 +64,21 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
public void onOpenUpdate() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
public void refreshData() {
|
||||
if (getView() == null){
|
||||
if (getView() == null) {
|
||||
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));
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
int countMaps = 0;
|
||||
long size = 0;
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
updateCount(IndexConstants.MAPS_PATH);
|
||||
|
@ -84,8 +87,7 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
}
|
||||
|
||||
protected void updateCount(String s) {
|
||||
if (!DashDownloadMapsFragment.this.isAdded() ||
|
||||
getMyApplication() == null){
|
||||
if (!DashDownloadMapsFragment.this.isAdded() || getMyApplication() == null) {
|
||||
return;
|
||||
}
|
||||
File ms = getMyApplication().getAppPath(s);
|
||||
|
@ -105,17 +107,15 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
|
|||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
if (!DashDownloadMapsFragment.this.isAdded()
|
||||
|| getMyApplication() == null){
|
||||
if (!DashDownloadMapsFragment.this.isAdded() || getMyApplication() == null) {
|
||||
return;
|
||||
}
|
||||
if(countMaps > 0) {
|
||||
if (countMaps > 0) {
|
||||
long mb = 1 << 20;
|
||||
long gb = 1 << 30;
|
||||
String sz = size > gb ?
|
||||
formatGb.format(new Object[] { (float) size / (gb) }) :
|
||||
formatMb.format(new Object[] { (float) size / mb }) ;
|
||||
message.setText(getString(R.string.dash_download_msg, countMaps+"") + " (" + sz +")");
|
||||
String sz = size > gb ? formatGb.format(new Object[] { (float) size / (gb) }) : formatMb
|
||||
.format(new Object[] { (float) size / mb });
|
||||
message.setText(getString(R.string.dash_download_msg, countMaps + "") + " (" + sz + ")");
|
||||
local.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 02.12.14.
|
||||
* Created by Denis on 02.12.14.
|
||||
*/
|
||||
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);
|
||||
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
|
||||
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.setText(msg);
|
||||
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("\nApp Version : ").append(Version.getAppName(getMyApplication())); //$NON-NLS-1$
|
||||
try {
|
||||
PackageInfo info = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||
PackageInfo info = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),
|
||||
0);
|
||||
if (info != null) {
|
||||
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() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ActionBarActivity dashboardActivity =((ActionBarActivity)getActivity());
|
||||
ActionBarActivity dashboardActivity = ((ActionBarActivity) getActivity());
|
||||
if (dashboardActivity != null) {
|
||||
dashboardActivity.getSupportFragmentManager().beginTransaction().remove(DashErrorFragment.this).commit();
|
||||
dashboardActivity.getSupportFragmentManager().beginTransaction().remove(DashErrorFragment.this)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpenUpdate() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
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.content.Context;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.view.WindowManager;
|
||||
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
|
||||
* 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_90 = 3;
|
||||
|
|
Loading…
Reference in a new issue