Add a popup to try out the advanced settings

multisite
Floens 10 years ago
parent d90d680d39
commit adc9d63ebb
  1. 25
      Clover/app/src/main/java/org/floens/chan/ui/controller/MainSettingsController.java
  2. 52
      Clover/app/src/main/java/org/floens/chan/ui/helper/HintPopup.java
  3. 25
      Clover/app/src/main/res/anim/menu_overflow_shake.xml
  4. 21
      Clover/app/src/main/res/drawable/background_accent_rounded.xml
  5. 32
      Clover/app/src/main/res/drawable/background_hint_arrow.xml
  6. 47
      Clover/app/src/main/res/layout/popup_hint.xml
  7. 2
      Clover/app/src/main/res/values/strings.xml

@ -23,12 +23,15 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Toast;
import org.floens.chan.Chan;
import org.floens.chan.R;
import org.floens.chan.core.settings.ChanSettings;
import org.floens.chan.ui.helper.HintPopup;
import org.floens.chan.ui.helper.RefreshUIMessage;
import org.floens.chan.ui.settings.BooleanSettingView;
import org.floens.chan.ui.settings.LinkSettingView;
@ -61,6 +64,9 @@ public class MainSettingsController extends SettingsController implements Toolba
private int clickCount;
private SettingView developerView;
private SettingView fontView;
private ToolbarMenuItem overflow;
private PopupWindow advancedSettingsHint;
public MainSettingsController(Context context) {
super(context);
@ -72,7 +78,7 @@ public class MainSettingsController extends SettingsController implements Toolba
navigationItem.setTitle(R.string.settings_screen);
navigationItem.menu = new ToolbarMenu(context);
navigationItem.createOverflow(context, this, Collections.singletonList(
overflow = navigationItem.createOverflow(context, this, Collections.singletonList(
new FloatingMenuItem(ADVANCED_SETTINGS, R.string.settings_screen_advanced)
));
@ -91,6 +97,23 @@ public class MainSettingsController extends SettingsController implements Toolba
if (!ChanSettings.developer.get()) {
developerView.view.getLayoutParams().height = 0;
}
ChanSettings.settingsOpenCounter.set(ChanSettings.settingsOpenCounter.get() + 1);
if (ChanSettings.settingsOpenCounter.get() == 3) {
ImageView view = overflow.getView();
view.startAnimation(android.view.animation.AnimationUtils.loadAnimation(context, R.anim.menu_overflow_shake));
advancedSettingsHint = HintPopup.show(context, view, R.string.settings_advanced_hint);
}
}
@Override
public void onHide() {
super.onHide();
if (advancedSettingsHint != null) {
advancedSettingsHint.dismiss();
advancedSettingsHint = null;
}
}
@Override

@ -0,0 +1,52 @@
package org.floens.chan.ui.helper;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import org.floens.chan.R;
import static org.floens.chan.utils.AndroidUtils.dp;
import static org.floens.chan.utils.AndroidUtils.getString;
public class HintPopup {
public static PopupWindow show(Context context, View anchor, int text) {
return show(context, anchor, getString(text));
}
public static PopupWindow show(final Context context, final View anchor, final String text) {
final LinearLayout popupView = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.popup_hint, null);
TextView textView = (TextView) popupView.findViewById(R.id.text);
textView.setText(text);
final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
popupView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
popupView.postDelayed(new Runnable() {
@Override
public void run() {
popupWindow.showAsDropDown(anchor, 0, -dp(25));
}
}, 100);
popupView.postDelayed(new Runnable() {
@Override
public void run() {
popupWindow.dismiss();
}
}, 7500);
return popupWindow;
}
}

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="60"
android:fromDegrees="-7"
android:pivotX="25%"
android:pivotY="50%"
android:repeatCount="15"
android:repeatMode="reverse"
android:toDegrees="7" />

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorAccent" />
<corners android:radius="2dp" />
</shape>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="-40%"
android:pivotY="87%"
android:toDegrees="45">
<shape
android:shape="rectangle">
<solid
android:color="?attr/colorAccent" />
</shape>
</rotate>
</item>
</layer-list>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?><!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<FrameLayout
android:id="@+id/arrow"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="right"
android:layout_marginRight="14dp"
android:background="@drawable/background_hint_arrow" />
<FrameLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_accent_rounded">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="#ffffff" />
</FrameLayout>
</LinearLayout>

@ -316,6 +316,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="settings_board_edit">Boards</string>
<string name="settings_watch">Thread watcher</string>
<string name="settings_pass">4chan pass</string>
<string name="settings_advanced_hint">Try the advanced settings!</string>
<string name="settings_group_appearance">Appearance</string>
@ -376,6 +377,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="setting_post_file_info">Show file info on posts</string>
<string name="setting_post_filename">Show filename on posts</string>
<string name="setting_never_hide_toolbar">Never hide the toolbar</string>
<string name="setting_controller_swipeable">Allow screens to be swiped away</string>
<string name="settings_group_proxy">HTTP Proxy</string>
<string name="setting_proxy_enabled">Enable proxy</string>

Loading…
Cancel
Save