Merge branch 'bes-material' into material

material
Floens 11 years ago
commit 3def1b92b1
  1. 2
      Clover/app/src/main/java/org/floens/chan/chan/ImageSearch.java
  2. 4
      Clover/app/src/main/java/org/floens/chan/core/ChanPreferences.java
  3. 18
      Clover/app/src/main/java/org/floens/chan/ui/activity/BaseActivity.java
  4. 10
      Clover/app/src/main/java/org/floens/chan/ui/activity/ChanActivity.java
  5. 12
      Clover/app/src/main/java/org/floens/chan/ui/fragment/ImageViewFragment.java
  6. 3
      Clover/app/src/main/res/anim/fade_in.xml
  7. 3
      Clover/app/src/main/res/anim/fade_out.xml
  8. 12
      Clover/app/src/main/res/drawable/pin_icon_blue.xml
  9. 12
      Clover/app/src/main/res/drawable/pin_icon_gray.xml
  10. 12
      Clover/app/src/main/res/drawable/pin_icon_red.xml
  11. 6
      Clover/app/src/main/res/layout/board_edit_item.xml
  12. 6
      Clover/app/src/main/res/layout/board_select_add.xml
  13. 6
      Clover/app/src/main/res/layout/board_select_spinner.xml
  14. 6
      Clover/app/src/main/res/layout/board_select_spinner_dropdown.xml
  15. 3
      Clover/app/src/main/res/layout/image_view.xml
  16. 3
      Clover/app/src/main/res/menu/settings.xml
  17. 3
      Clover/app/src/main/res/values/colors.xml
  18. 3
      Clover/app/src/main/res/values/dimens.xml
  19. 4
      Clover/app/src/main/res/values/strings.xml
  20. 5
      Clover/app/src/main/res/xml/preference_advanced.xml
  21. 3
      Clover/app/src/main/res/xml/preference_pass.xml

@ -26,7 +26,9 @@ public abstract class ImageSearch {
public static final List<ImageSearch> engines = new ArrayList<>(); public static final List<ImageSearch> engines = new ArrayList<>();
public abstract int getId(); public abstract int getId();
public abstract String getName(); public abstract String getName();
public abstract String getUrl(String imageUrl); public abstract String getUrl(String imageUrl);
static { static {

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

@ -113,6 +113,15 @@ public abstract class BaseActivity extends ThemeActivity implements PanelSlideLi
updateIcon(); updateIcon();
} }
@Override
public void onBackPressed() {
if (pinDrawer.isDrawerOpen(pinDrawerView)) {
pinDrawer.closeDrawer(pinDrawerView);
} else {
super.onBackPressed();
}
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
@ -364,12 +373,9 @@ public abstract class BaseActivity extends ThemeActivity implements PanelSlideLi
* @param url * @param url
*/ */
public void showUrlOpenPicker(String url) { public void showUrlOpenPicker(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); startActivity(intent);
pickIntent.putExtra(Intent.EXTRA_INTENT, intent);
startActivityForResult(pickIntent, ACTION_OPEN_URL);
} }
/** /**

@ -201,12 +201,16 @@ public class ChanActivity extends BaseActivity implements AdapterView.OnItemSele
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (pinDrawer.isDrawerOpen(pinDrawerView)) {
pinDrawer.closeDrawer(pinDrawerView);
} else {
if (threadPane.isOpen()) { if (threadPane.isOpen()) {
super.onBackPressed(); super.onBackPressed();
} else { } else {
threadPane.openPane(); threadPane.openPane();
} }
} }
}
@Override @Override
public void openPin(Pin pin) { public void openPin(Pin pin) {
@ -482,8 +486,12 @@ public class ChanActivity extends BaseActivity implements AdapterView.OnItemSele
if (threadFragment.hasLoader()) { if (threadFragment.hasLoader()) {
Loader loader = threadFragment.getLoader(); Loader loader = threadFragment.getLoader();
if (loader != null && loader.getLoadable().isThreadMode() && loader.getThread() != null) { if (loader != null && loader.getLoadable().isThreadMode() && loader.getThread() != null) {
Pin pin = ChanApplication.getWatchManager().findPinByLoadable(threadLoadable);
if (pin != null) {
ChanApplication.getWatchManager().removePin(pin);
} else {
ChanApplication.getWatchManager().addPin(loader.getLoadable(), loader.getThread().op); ChanApplication.getWatchManager().addPin(loader.getLoadable(), loader.getThread().op);
pinDrawer.openDrawer(pinDrawerView); }
updateActionBarState(); updateActionBarState();
} }
} }

@ -21,6 +21,7 @@ import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -241,9 +242,13 @@ public class ImageViewFragment extends Fragment implements ThumbnailImageViewCal
break; break;
case R.id.action_image_save: case R.id.action_image_save:
case R.id.action_share: case R.id.action_share:
if (ChanPreferences.getImageShareUrl()) {
shareImageUrl(post.imageUrl);
} else {
ImageSaver.getInstance().saveImage(context, post.imageUrl, ImageSaver.getInstance().saveImage(context, post.imageUrl,
ChanPreferences.getImageSaveOriginalFilename() ? Long.toString(post.tim) : post.filename, post.ext, ChanPreferences.getImageSaveOriginalFilename() ? Long.toString(post.tim) : post.filename, post.ext,
item.getItemId() == R.id.action_share); item.getItemId() == R.id.action_share);
}
break; break;
default: default:
// Search if it was an ImageSearch item // 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) { public void onVideoError(File video) {
if (ChanPreferences.getVideoErrorIgnore()) { if (ChanPreferences.getVideoErrorIgnore()) {
Toast.makeText(context, R.string.image_open_failed, Toast.LENGTH_SHORT).show(); Toast.makeText(context, R.string.image_open_failed, Toast.LENGTH_SHORT).show();

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,16 +15,13 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<inset <inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="8dp" android:insetLeft="8dp"
android:insetTop="8dp" android:insetTop="8dp"
android:insetRight="8dp" android:insetRight="8dp"
android:insetBottom="8dp"> android:insetBottom="8dp">
<shape> <shape>
<solid <solid android:color="#FF33B5E5" />
android:color="#FF33B5E5"/> <corners android:radius="4dp" />
<corners
android:radius="4dp"/>
</shape> </shape>
</inset> </inset>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,16 +15,13 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<inset <inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="8dp" android:insetLeft="8dp"
android:insetTop="8dp" android:insetTop="8dp"
android:insetRight="8dp" android:insetRight="8dp"
android:insetBottom="8dp"> android:insetBottom="8dp">
<shape> <shape>
<solid <solid android:color="#FF898989" />
android:color="#FF898989"/> <corners android:radius="4dp" />
<corners
android:radius="4dp"/>
</shape> </shape>
</inset> </inset>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,16 +15,13 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<inset <inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="8dp" android:insetLeft="8dp"
android:insetTop="8dp" android:insetTop="8dp"
android:insetRight="8dp" android:insetRight="8dp"
android:insetBottom="8dp"> android:insetBottom="8dp">
<shape> <shape>
<solid <solid android:color="#FFFF4444" />
android:color="#FFFF4444"/> <corners android:radius="4dp" />
<corners
android:radius="4dp"/>
</shape> </shape>
</inset> </inset>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,8 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<FrameLayout <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,8 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<TextView <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,8 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<TextView <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -16,8 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<TextView <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

@ -41,7 +41,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
style="@style/Widget.AppCompat.ProgressBar.Horizontal" style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginTop="-7dp" />
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens
@ -195,6 +194,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_image_save_location">Image save folder</string>
<string name="preference_network_https">Use HTTPS</string> <string name="preference_network_https">Use HTTPS</string>
<string name="preference_image_save_original">Save original filename</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_open_link_confirmation">Ask before opening links</string>
<string name="preference_autoplay">Start playing videos immediately</string> <string name="preference_autoplay">Start playing videos immediately</string>
<string name="preference_auto_refresh_thread">Auto refresh threads</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:key="preference_image_save_original"
android:title="@string/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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="preference_network_https" android:key="preference_network_https"

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Clover - 4chan browser https://github.com/Floens/Clover/ Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens Copyright (C) 2014 Floens

Loading…
Cancel
Save