Fix errors

This commit is contained in:
Victor Shcherb 2015-03-08 15:05:54 +01:00
parent f577beaae6
commit 62f3a55deb
6 changed files with 111 additions and 113 deletions

View file

@ -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"/> -->

View file

@ -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();

View file

@ -29,9 +29,7 @@ public abstract class DashBaseFragment extends Fragment {
}
}
public void onOpenUpdate() {
// TODO
}
public void onOpenUpdate() {}
public void onLocationCompassChanged(Location l, double compassValue) {

View file

@ -29,7 +29,8 @@ 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));
message.setTypeface(typeface);
@ -39,7 +40,8 @@ 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);
getActivity().startActivity(intent);
@ -51,7 +53,8 @@ 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);
getActivity().startActivity(intent);
@ -61,8 +64,7 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
}
@Override
public void onResume() {
super.onResume();
public void onOpenUpdate() {
refreshData();
}
@ -76,6 +78,7 @@ public class DashDownloadMapsFragment extends DashBaseFragment {
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,16 +107,14 @@ 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) {
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 }) ;
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 {

View file

@ -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 {
@ -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$
}
@ -75,10 +75,15 @@ public class DashErrorFragment extends DashBaseFragment {
public void onClick(View view) {
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() {
}
}

View file

@ -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;