Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-09-02 16:38:03 +02:00
commit fbd2c81cdc
8 changed files with 26 additions and 282 deletions

View file

@ -16,7 +16,7 @@
<TextView
android:id="@+id/filter_poi_label"
android:textSize="@dimen/default_list_text_size_large"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorPrimary"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/Text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dip"
android:layout_marginLeft="20dip"
android:layout_marginTop="12dip"
android:gravity="center_vertical"
android:textSize="@dimen/default_list_text_size_large"></TextView>
</LinearLayout>

View file

@ -25,7 +25,7 @@
android:layout_marginBottom="11dip"
android:gravity="center_vertical"
android:text="@string/layer_poi"
android:textSize="@dimen/default_list_text_size_large"
android:textSize="@dimen/default_list_text_size"
android:layout_weight="1" />
<LinearLayout

View file

@ -3,12 +3,14 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="3dp"
android:paddingTop="3dp">
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<TextView
android:id="@+id/NameLabel"
android:textSize="@dimen/default_list_text_size_large"
android:textSize="@dimen/default_list_text_size"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>

View file

@ -17,7 +17,7 @@
<TextView
android:id="@+id/folder_label"
android:textSize="@dimen/default_list_text_size_large"
android:textSize="@dimen/default_list_text_size"
android:layout_gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:layout_width="0dp"

View file

@ -1,17 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="48dp"
android:drawablePadding="24dp"
android:gravity="center_vertical"
android:padding="16dp"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableLeft="@drawable/ic_action_search_dark"
tools:text="@string/layer_poi"/>
android:layout_height="@dimen/list_item_height" >
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:drawablePadding="24dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableLeft="@drawable/ic_action_search_dark"
tools:text="@string/layer_poi" />
</LinearLayout>

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<net.osmand.access.ExplorableTextView
android:id="@+id/TipDescription"
android:textSize="@dimen/default_list_text_size_large"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_weight="1"
android:gravity="fill_horizontal"
android:scrollbars="vertical"
android:text="" />
<!-- <TextView android:text="@string/poi_dialog_other_tags_message" android:id="@+id/TextView" android:layout_marginLeft="5dp"
android:layout_width="fill_parent" android:layout_height="wrap_content" /> -->
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="bottom|center"
android:orientation="horizontal">
<Button
android:id="@+id/PreviousButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="70dp"
android:text="@string/shared_string_previous" />
<Button
android:id="@+id/NextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="70dp"
android:text="@string/shared_string_next" />
<Button
android:id="@+id/CloseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="70dp"
android:text="@string/shared_string_close" />
</LinearLayout>
</LinearLayout>

View file

@ -1,196 +0,0 @@
package net.osmand.plus.activities;
import gnu.trove.list.array.TIntArrayList;
import java.util.Arrays;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import android.app.Dialog;
import android.content.Context;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.TextView;
public class TipsAndTricksActivity {
private int[][] tipNamesAndDescriptions = new int[][] {
{R.string.tip_recent_changes,R.string.tip_recent_changes_1_7_1_t},
{R.string.tip_update_index,R.string.tip_update_index_t},
{R.string.tip_navigation,R.string.tip_navigation_t},
{R.string.tip_app_mode,R.string.tip_app_mode_t_v2},
{R.string.tip_faq,R.string.tip_faq_t},
{R.string.tip_search,R.string.tip_search_t},
{R.string.tip_favorites,R.string.tip_favorites_t},
{R.string.tip_map_context_menu,R.string.tip_map_context_menu_t},
{R.string.tip_rotation_switching,R.string.tip_rotation_switching_t_v2},
{R.string.tip_day_night_mode,R.string.tip_day_night_mode_t_v2},
{R.string.tip_map_styles,R.string.tip_map_styles_t},
{R.string.tip_altitude_offset,R.string.tip_altitude_offset_t},
{R.string.tip_map_switch,R.string.tip_map_switch_t_v2},
{R.string.tip_location_sharing,R.string.tip_location_sharing_t},
{R.string.tip_osm_improve,R.string.tip_osm_improve_t},
};
private final Context ctx;
private int numberOfShownTips = 0;
private boolean[] shownTips = new boolean[tipNamesAndDescriptions.length];
public TipsAndTricksActivity(Context ctx){
this.ctx = ctx;
}
public boolean areAllTipsShown(){
return numberOfShownTips == tipNamesAndDescriptions.length;
}
public int getNumberOfTips(){
return tipNamesAndDescriptions.length;
}
public void markTipAsShown(int index) {
if (!shownTips[index]) {
shownTips[index] = true;
numberOfShownTips++;
}
}
public int getNextRandomTipToShow() {
int l = getNumberOfTips();
if (l != 0) {
// no random
// int mod = (int) (System.currentTimeMillis() % l);
return getNextTipToShow(0);
}
return -1;
}
public void clearShownInfo(){
Arrays.fill(shownTips, false);
numberOfShownTips = 0;
}
public int getNextTipToShow(int suggest) {
int l = getNumberOfTips();
if(suggest >= l || suggest < 0){
suggest = 0;
}
if (l > 0) {
int it = suggest;
do {
if (!shownTips[it]) {
markTipAsShown(it);
return it;
}
it++;
if (it == l) {
it = 0;
}
} while (it != suggest);
clearShownInfo();
markTipAsShown(suggest);
return suggest;
}
return -1;
}
public String getTipName(int ind){
return ctx.getString(tipNamesAndDescriptions[ind][0]);
}
public CharSequence getTipDescription(int ind){
String descr = ctx.getString(tipNamesAndDescriptions[ind][1]);
SpannableString spannable = new SpannableString(descr);
Linkify.addLinks(spannable, Linkify.ALL);
return spannable;
}
public Dialog getDialogToShowTips(boolean showFirst, boolean random){
final Dialog dlg = new Dialog(ctx);
dlg.setContentView(R.layout.tips_and_tricks);
dlg.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
final TextView tipDescription = (TextView) dlg.findViewById(R.id.TipDescription);
if (!((OsmandApplication)ctx.getApplicationContext()).accessibilityExtensions()) {
// tipDescription.setMovementMethod(ScrollingMovementMethod.getInstance());
tipDescription.setMovementMethod(LinkMovementMethod.getInstance());
}
tipDescription.setLinksClickable(true);
int nextInd = 0;
final TIntArrayList toShow = new TIntArrayList();
final int[] historyInd = new int[1];
if(showFirst){
dlg.setTitle(R.string.shared_string_help);
tipDescription.setText(R.string.tip_initial_t);
historyInd[0] = -1;
} else if(!random){
nextInd = 0;
dlg.setTitle(getTipName(nextInd));
tipDescription.setText(getTipDescription(nextInd));
toShow.add(nextInd);
historyInd[0] = 0;
} else {
nextInd = getNextRandomTipToShow();
dlg.setTitle(getTipName(nextInd));
tipDescription.setText(getTipDescription(nextInd));
toShow.add(nextInd);
historyInd[0] = 0;
}
final Button nextButton = ((Button)dlg.findViewById(R.id.NextButton));
final Button prevButton = (Button)dlg.findViewById(R.id.PreviousButton);
prevButton.setEnabled(historyInd[0] > 0);
nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1);
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(historyInd[0] == toShow.size() - 1){
int suggest = 0;
if(historyInd[0] >= 0) {
suggest = toShow.get(historyInd[0]) + 1;
}
toShow.add(getNextTipToShow(suggest));
}
historyInd[0] ++;
dlg.setTitle(getTipName(toShow.get(historyInd[0])));
tipDescription.setText(getTipDescription(toShow.get(historyInd[0])));
tipDescription.scrollTo(0, 0);
prevButton.setEnabled(historyInd[0] > 0);
nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1);
}
});
prevButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(historyInd[0] > 0){
historyInd[0] --;
dlg.setTitle(getTipName(toShow.get(historyInd[0])));
tipDescription.setText(getTipDescription(toShow.get(historyInd[0])));
tipDescription.scrollTo(0, 0);
}
prevButton.setEnabled(historyInd[0] > 0);
nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1);
}
});
((Button)dlg.findViewById(R.id.CloseButton)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dlg.dismiss();
}
});
return dlg;
}
}