Merge pull request #5526 from osmandapp/PaulsBranch

Pauls branch
This commit is contained in:
Alexander Sytnyk 2018-05-31 14:32:21 +03:00 committed by GitHub
commit 807a3fa238
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 11 deletions

View file

@ -39,9 +39,8 @@
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="com.sec.feature.spen_usp" android:required="false"/>
<!-- com.getkeepsafe.taptargetview, studio.carbonylgroup.textfieldboxes, android.support.customtabs -->
<uses-sdk android:targetSdkVersion="26" android:minSdkVersion="15"
tools:overrideLibrary=""/>
tools:overrideLibrary="com.getkeepsafe.taptargetview, studio.carbonylgroup.textfieldboxes, android.support.customtabs"/>
<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
android:xlargeScreens="true" android:anyDensity="true" />

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -212,10 +213,16 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
}
public static void showFullArticle(@NonNull Context context, @NonNull Uri uri, boolean nightMode) {
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
.setToolbarColor(ContextCompat.getColor(context, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
.build();
customTabsIntent.launchUrl(context, uri);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
.setToolbarColor(ContextCompat.getColor(context, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
.build();
customTabsIntent.launchUrl(context, uri);
} else {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(uri);
context.startActivity(i);
}
}
@Override

View file

@ -13,6 +13,7 @@ import android.widget.TextView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
public class StartEditingTravelCard extends BaseTravelCard {
@ -36,11 +37,8 @@ public class StartEditingTravelCard extends BaseTravelCard {
holder.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
.setToolbarColor(ContextCompat.getColor(app, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
.build();
String text = "https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org";
customTabsIntent.launchUrl(context, Uri.parse(text));
WikipediaDialogFragment.showFullArticle(context,
Uri.parse("https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org"), nightMode);
}
});
}