Merge pull request #1188 from ujjwalagrawal17/feat5

Rate Us feature added
This commit is contained in:
neslihanturan 2018-02-28 11:26:54 +02:00 committed by GitHub
commit e207edc0e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 26 deletions

View file

@ -73,5 +73,4 @@ public class AboutActivity extends NavigationBaseActivity {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
}
}

View file

@ -165,6 +165,17 @@ public class Utils {
return stringBuilder.toString();
}
public static void rateApp(Context context) {
final String appPackageName = context.getPackageName();
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
}
catch (android.content.ActivityNotFoundException anfe) {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
return ;
}
public static void handleWebUrl(Context context,Uri url){
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(ContextCompat.getColor(context, R.color.primaryColor));

View file

@ -23,6 +23,7 @@ import fr.free.nrw.commons.AboutActivity;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.WelcomeActivity;
import fr.free.nrw.commons.auth.AccountUtil;
import fr.free.nrw.commons.auth.LoginActivity;

View file

@ -104,20 +104,31 @@
</LinearLayout>
<fr.free.nrw.commons.ui.widget.HtmlTextView
<TextView
android:id="@+id/about_rate_us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap"
android:gravity="center"
android:textColor="@color/primaryColor"
android:text="@string/about_rate_us" />
<TextView
android:id="@+id/about_privacy_policy"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap"
android:textColor="@color/primaryColor"
android:gravity="center"
android:text="@string/about_privacy_policy" />
<fr.free.nrw.commons.ui.widget.HtmlTextView
<TextView
android:id="@+id/about_credits"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primaryColor"
android:layout_marginTop="@dimen/standard_gap"
android:gravity="center"
android:text="@string/about_credits" />

View file

@ -237,4 +237,5 @@
<string name="notifications_thank_you_edit">Thank you for making an edit</string>
<string name="notifications_mention">%1$s mentioned you on %2$s.</string>
<string name="toggle_view_button">Toggle view</string>
<string name="about_rate_us"><u>Rate Us</u></string>
</resources>