mirror of
https://github.com/LibreOffice/online.git
synced 2025-08-20 16:39:17 +00:00
android: Beautify the rating dialog.
Change-Id: I2114b42cf0f21526ab4035c1ad69ba25dee4aa7b Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90678 Tested-by: Jan Holesovsky <kendy@collabora.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
This commit is contained in:
@ -24,6 +24,7 @@ android {
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
resValue "string", "app_name", "${liboAppName} Debug"
|
||||
buildConfigField "String", "GIT_COMMIT", "\"${liboGitFullCommit}\""
|
||||
buildConfigField "boolean", "GOOGLE_PLAY_ENABLED", "${liboGooglePlay}"
|
||||
ndk {
|
||||
@ -33,6 +34,7 @@ android {
|
||||
debuggable true
|
||||
}
|
||||
release {
|
||||
resValue "string", "app_name", "${liboAppName}"
|
||||
buildConfigField "String", "GIT_COMMIT", "\"${liboGitFullCommit}\""
|
||||
buildConfigField "boolean", "GOOGLE_PLAY_ENABLED", "${liboGooglePlay}"
|
||||
ndk {
|
||||
|
@ -1,4 +1,5 @@
|
||||
ext {
|
||||
liboAppName = '@APP_NAME@'
|
||||
liboSrcRoot = '@LOBUILDDIR@'
|
||||
liboInstdir = '@LOBUILDDIR@/instdir'
|
||||
liboEtcFolder = 'program'
|
||||
|
@ -9,9 +9,11 @@
|
||||
|
||||
package org.libreoffice.androidlib;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RatingBar;
|
||||
|
||||
@ -57,28 +59,32 @@ public class RateAppController {
|
||||
if (!shouldAsk())
|
||||
return;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
final View rateAppLayout = mActivity.getLayoutInflater().inflate(R.layout.rate_app_layout, null);
|
||||
builder.setView(rateAppLayout);
|
||||
|
||||
builder.setPositiveButton(R.string.rate_now, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// start google play activity for rating
|
||||
openInGooglePlay();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.later, null);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setView(rateAppLayout)
|
||||
.setTitle(String.format(mActivity.getString(R.string.rate_our_app_title), mActivity.getString(R.string.app_name)))
|
||||
.setPositiveButton(R.string.rate_now, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// start google play activity for rating
|
||||
openInGooglePlay();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.later, null);
|
||||
|
||||
final AlertDialog alertDialog = builder.create();
|
||||
|
||||
RatingBar ratingBar = rateAppLayout.findViewById(R.id.ratingBar);
|
||||
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
|
||||
ratingBar.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public void onRatingChanged(RatingBar ratingBar1, float v, boolean b) {
|
||||
// start google play activity for rating
|
||||
openInGooglePlay();
|
||||
alertDialog.dismiss();
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
// start google play activity for rating
|
||||
openInGooglePlay();
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
|
@ -1,28 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="36dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingEnd="36dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="24dp"
|
||||
android:text="@string/rate_our_app_text"
|
||||
android:padding="10dp"
|
||||
android:textColor="@color/text_color_secondary"/>
|
||||
android:textAlignment="center" />
|
||||
|
||||
<RatingBar
|
||||
android:id="@+id/ratingBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="false"
|
||||
android:isIndicator="false"
|
||||
android:max="5"
|
||||
android:numStars="5"
|
||||
android:rating="0"
|
||||
android:stepSize="1"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="12dp"
|
||||
/>
|
||||
android:rating="5"
|
||||
android:stepSize="1" />
|
||||
</LinearLayout>
|
@ -8,7 +8,8 @@
|
||||
<string name="preparing_for_the_first_start_after_an_update">Preparing for the first start after an update.</string>
|
||||
<string name="rate_now">Rate now</string>
|
||||
<string name="later">Later</string>
|
||||
<string name="rate_our_app_text">Thank you for using our app! If you enjoy using it, please give us a 5-stars review in Google Play.</string>
|
||||
<string name="rate_our_app_title">Thank you for using %1$s!</string>
|
||||
<string name="rate_our_app_text">If you like it, please give us 5 stars in Google Play. Your good reviews are our best motivation.</string>
|
||||
|
||||
<!-- Loading SlideShow Dialog Strings -->
|
||||
<string name="loading">Loading...</string>
|
||||
|
Reference in New Issue
Block a user