Added option to share a link to the image instead of the image itself

material^2
Kevin Richter 11 years ago
parent 9feb501e88
commit b8416faa6a
  1. 4
      Clover/app/src/main/java/org/floens/chan/core/ChanPreferences.java
  2. 12
      Clover/app/src/main/java/org/floens/chan/ui/fragment/ImageViewFragment.java
  3. 1
      Clover/app/src/main/res/values/strings.xml
  4. 5
      Clover/app/src/main/res/xml/preference_advanced.xml

@ -69,6 +69,10 @@ public class ChanPreferences {
return p().getBoolean("preference_image_save_original", false);
}
public static boolean getImageShareUrl() {
return p().getBoolean("preference_image_share_url", false);
}
public static boolean getWatchEnabled() {
return p().getBoolean("preference_watch_enabled", false);
}

@ -21,6 +21,7 @@ import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -241,9 +242,13 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal
break;
case R.id.action_image_save:
case R.id.action_share:
if(ChanPreferences.getImageShareUrl()) {
shareImageUrl(post.imageUrl);
} else {
ImageSaver.getInstance().saveImage(context, post.imageUrl,
ChanPreferences.getImageSaveOriginalFilename() ? Long.toString(post.tim) : post.filename, post.ext,
item.getItemId() == R.id.action_share);
}
break;
default:
// Search if it was an ImageSearch item
@ -258,6 +263,13 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal
}
}
private void shareImageUrl(String url) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, url);
context.startActivity(Intent.createChooser(intent, context.getString(R.string.action_share)));
}
public void onVideoError(File video) {
if (ChanPreferences.getVideoErrorIgnore()) {
Toast.makeText(context, R.string.image_open_failed, Toast.LENGTH_SHORT).show();

@ -195,6 +195,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="preference_image_save_location">Image save folder</string>
<string name="preference_network_https">Use HTTPS</string>
<string name="preference_image_save_original">Save original filename</string>
<string name="preference_image_share_url">Share url to image</string>
<string name="preference_open_link_confirmation">Ask before opening links</string>
<string name="preference_autoplay">Start playing videos immediately</string>
<string name="preference_auto_refresh_thread">Auto refresh threads</string>

@ -25,6 +25,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:key="preference_image_save_original"
android:title="@string/preference_image_save_original" />
<CheckBoxPreference
android:defaultValue="false"
android:key="preference_image_share_url"
android:title="@string/preference_image_share_url" />
<CheckBoxPreference
android:defaultValue="true"
android:key="preference_network_https"

Loading…
Cancel
Save