Skip to content

Commit

Permalink
Merge pull request #284 from maks/283-share-menu-appcompat-fix
Browse files Browse the repository at this point in the history
use the correct shareprovider for appcompat menus
  • Loading branch information
maks authored Mar 19, 2018
2 parents 8daf6e6 + 7114054 commit dbfc6a8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {

vectorDrawables.useSupportLibrary = true

versionCode 206
versionName "1.5.4.1"
versionCode 207
versionName "1.5.4.2"
}

dataBinding {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/me/sheimi/sgit/SGitApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ protected void attachBaseContext(Context base) {
super.attachBaseContext(base);

// The following line triggers the initialization of ACRA
ACRA.init(this);
if (!BuildConfig.DEBUG) {
ACRA.init(this);
}
}


Expand Down
37 changes: 18 additions & 19 deletions app/src/main/java/me/sheimi/sgit/activities/CommitDiffActivity.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
package me.sheimi.sgit.activities;

import java.util.List;

import me.sheimi.android.activities.SheimiFragmentActivity;
import me.sheimi.android.utils.CodeGuesser;
import me.sheimi.android.utils.FsUtils;
import me.sheimi.android.utils.Profile;
import me.sheimi.sgit.R;
import me.sheimi.sgit.database.models.Repo;
import me.sheimi.sgit.repo.tasks.repo.CommitDiffTask;
import me.sheimi.sgit.repo.tasks.repo.CommitDiffTask.CommitDiffResult;

import org.eclipse.jgit.diff.DiffEntry;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.ShareActionProvider;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
Expand All @@ -25,16 +15,25 @@
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ProgressBar;
import org.eclipse.jgit.revwalk.RevCommit;

import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.lib.PersonIdent;
import android.widget.ShareActionProvider;
import android.content.Intent;
import android.net.Uri;
import org.eclipse.jgit.revwalk.RevCommit;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import me.sheimi.android.activities.SheimiFragmentActivity;
import me.sheimi.android.utils.CodeGuesser;
import me.sheimi.android.utils.FsUtils;
import me.sheimi.android.utils.Profile;
import me.sheimi.sgit.R;
import me.sheimi.sgit.database.models.Repo;
import me.sheimi.sgit.repo.tasks.repo.CommitDiffTask;
import me.sheimi.sgit.repo.tasks.repo.CommitDiffTask.CommitDiffResult;

public class CommitDiffActivity extends SheimiFragmentActivity {

Expand Down Expand Up @@ -104,7 +103,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.diff_commits, menu);
MenuItem item = menu.findItem(R.id.action_share_diff);
ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider();
ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri futurePathName = Uri.fromFile(sharedDiffPathName());
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/menu/diff_commits.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_share_diff"
android:showAsAction="ifRoom"
android:title="@string/action_share_diff"
android:actionProviderClass="android.widget.ShareActionProvider" />
app:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
<item
android:id="@+id/action_save_diff"
android:icon="@drawable/ic_download"
Expand Down

0 comments on commit dbfc6a8

Please sign in to comment.