mirror of https://github.com/kurisufriend/Clover
parent
d90d680d39
commit
adc9d63ebb
@ -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> |
Loading…
Reference in new issue