Revision 2fad84a7
Added by Leszek Koltunski over 5 years ago
| build.gradle | ||
|---|---|---|
| 1 | 1 |
apply plugin: 'com.android.application' |
| 2 | 2 |
|
| 3 | 3 |
android {
|
| 4 |
compileSdkVersion 27
|
|
| 4 |
compileSdkVersion 29
|
|
| 5 | 5 |
|
| 6 | 6 |
defaultConfig {
|
| 7 | 7 |
applicationId "org.distorted.examples" |
| 8 | 8 |
minSdkVersion 21 |
| 9 |
targetSdkVersion 27
|
|
| 9 |
targetSdkVersion 29
|
|
| 10 | 10 |
versionCode 1 |
| 11 | 11 |
versionName "1.0" |
| 12 | 12 |
} |
| ... | ... | |
| 21 | 21 |
|
| 22 | 22 |
dependencies {
|
| 23 | 23 |
api project(':distorted-library')
|
| 24 |
implementation 'com.android.support:support-v4:27.1.1'
|
|
| 25 |
implementation 'com.android.support:support-v13:27.1.1'
|
|
| 26 |
implementation 'com.android.support:design:27.1.1'
|
|
| 24 |
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
| 25 |
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
|
| 26 |
implementation 'com.google.android.material:material:1.1.0'
|
|
| 27 | 27 |
} |
| src/main/java/org/distorted/examples/generic/GenericActivity2.java | ||
|---|---|---|
| 25 | 25 |
import android.graphics.Paint; |
| 26 | 26 |
import android.opengl.GLSurfaceView; |
| 27 | 27 |
import android.os.Bundle; |
| 28 |
import android.support.design.widget.TabLayout;
|
|
| 29 |
import android.support.v7.app.AppCompatActivity;
|
|
| 28 |
import com.google.android.material.tabs.TabLayout;
|
|
| 29 |
import androidx.appcompat.app.AppCompatActivity;
|
|
| 30 | 30 |
import android.view.View; |
| 31 | 31 |
import android.widget.CheckBox; |
| 32 | 32 |
|
| src/main/java/org/distorted/examples/generic/GenericTab.java | ||
|---|---|---|
| 20 | 20 |
package org.distorted.examples.generic; |
| 21 | 21 |
|
| 22 | 22 |
import android.os.Bundle; |
| 23 |
import android.support.annotation.NonNull;
|
|
| 24 |
import android.support.v4.app.Fragment;
|
|
| 23 |
import androidx.annotation.NonNull;
|
|
| 24 |
import androidx.fragment.app.Fragment;
|
|
| 25 | 25 |
import android.view.LayoutInflater; |
| 26 | 26 |
import android.view.View; |
| 27 | 27 |
import android.view.ViewGroup; |
| ... | ... | |
| 172 | 172 |
|
| 173 | 173 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 174 | 174 |
|
| 175 |
void newEffect() |
|
| 175 |
private void newEffect()
|
|
| 176 | 176 |
{
|
| 177 | 177 |
GenericActivity2 act = (GenericActivity2)getActivity(); |
| 178 | 178 |
GenericEffect eff = new GenericEffect(mEffectNames[mEffectAdd], act ); |
| ... | ... | |
| 223 | 223 |
|
| 224 | 224 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 225 | 225 |
|
| 226 |
void removeAll() |
|
| 226 |
private void removeAll()
|
|
| 227 | 227 |
{
|
| 228 | 228 |
GenericActivity2 act = (GenericActivity2)getActivity(); |
| 229 | 229 |
|
| ... | ... | |
| 244 | 244 |
|
| 245 | 245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 246 | 246 |
|
| 247 |
void remove(View v) |
|
| 247 |
private void remove(View v)
|
|
| 248 | 248 |
{
|
| 249 | 249 |
for(GenericEffect effect: mList) |
| 250 | 250 |
{
|
| ... | ... | |
| 287 | 287 |
|
| 288 | 288 |
int numEffects=0; |
| 289 | 289 |
|
| 290 |
for(int i=0; i<names.length; i++)
|
|
| 291 |
if( names[i].getType() == type ) numEffects++;
|
|
| 290 |
for( EffectName name: names )
|
|
| 291 |
if( name.getType() == type ) numEffects++; |
|
| 292 | 292 |
|
| 293 | 293 |
mEffectNames = new EffectName[numEffects]; |
| 294 | 294 |
|
| 295 | 295 |
numEffects=0; |
| 296 | 296 |
|
| 297 |
for(int i=0; i<names.length; i++)
|
|
| 298 |
if( names[i].getType() == type )
|
|
| 297 |
for( EffectName name: names )
|
|
| 298 |
if( name.getType() == type ) |
|
| 299 | 299 |
{
|
| 300 |
mEffectNames[numEffects++] = names[i];
|
|
| 300 |
mEffectNames[numEffects++] = name; |
|
| 301 | 301 |
} |
| 302 | 302 |
} |
| 303 | 303 |
} |
| src/main/java/org/distorted/examples/generic/GenericViewPager.java | ||
|---|---|---|
| 20 | 20 |
package org.distorted.examples.generic; |
| 21 | 21 |
|
| 22 | 22 |
import android.os.Bundle; |
| 23 |
import android.support.v4.app.Fragment; |
|
| 24 |
import android.support.v4.app.FragmentManager; |
|
| 25 |
import android.support.v4.app.FragmentPagerAdapter; |
|
| 26 |
import android.support.v4.view.ViewPager; |
|
| 27 |
import android.support.v7.app.AppCompatActivity; |
|
| 23 |
|
|
| 24 |
import androidx.annotation.NonNull; |
|
| 25 |
import androidx.fragment.app.Fragment; |
|
| 26 |
import androidx.fragment.app.FragmentManager; |
|
| 27 |
import androidx.fragment.app.FragmentPagerAdapter; |
|
| 28 |
|
|
| 29 |
import androidx.viewpager.widget.ViewPager; |
|
| 30 |
import androidx.appcompat.app.AppCompatActivity; |
|
| 28 | 31 |
|
| 29 | 32 |
import org.distorted.examples.R; |
| 30 | 33 |
import org.distorted.library.effect.EffectType; |
| ... | ... | |
| 50 | 53 |
private ViewPager mViewPager; |
| 51 | 54 |
private int mCurrentTab; |
| 52 | 55 |
|
| 53 |
private class GenericTabViewPager extends FragmentPagerAdapter |
|
| 56 |
private static class GenericTabViewPager extends FragmentPagerAdapter
|
|
| 54 | 57 |
{
|
| 55 | 58 |
GenericTabViewPager(FragmentManager fm) |
| 56 | 59 |
{
|
| ... | ... | |
| 58 | 61 |
} |
| 59 | 62 |
|
| 60 | 63 |
@Override |
| 64 |
@NonNull |
|
| 61 | 65 |
public Fragment getItem(int position) |
| 62 | 66 |
{
|
| 63 |
if( position>=0 && position<NUM_TABS ) |
|
| 64 |
{
|
|
| 65 |
GenericTab tab = new GenericTab(); |
|
| 67 |
GenericTab tab = new GenericTab(); |
|
| 66 | 68 |
|
| 67 |
Bundle bundle = new Bundle(); |
|
| 68 |
bundle.putInt("position", position);
|
|
| 69 |
tab.setArguments(bundle); |
|
| 70 |
|
|
| 71 |
return tab; |
|
| 72 |
} |
|
| 69 |
Bundle bundle = new Bundle(); |
|
| 70 |
bundle.putInt("position", position);
|
|
| 71 |
tab.setArguments(bundle); |
|
| 73 | 72 |
|
| 74 |
return null;
|
|
| 73 |
return tab;
|
|
| 75 | 74 |
} |
| 76 | 75 |
|
| 77 | 76 |
@Override |
| src/main/java/org/distorted/examples/save/SaveActivity.java | ||
|---|---|---|
| 27 | 27 |
import android.content.pm.PackageManager; |
| 28 | 28 |
import android.opengl.GLSurfaceView; |
| 29 | 29 |
import android.os.Bundle; |
| 30 |
import android.support.v4.app.ActivityCompat;
|
|
| 30 |
import androidx.core.app.ActivityCompat;
|
|
| 31 | 31 |
import android.view.View; |
| 32 | 32 |
import android.widget.SeekBar; |
| 33 | 33 |
|
| src/main/res/layout/deformlayout.xml | ||
|---|---|---|
| 64 | 64 |
android:layout_height="wrap_content" |
| 65 | 65 |
android:layout_weight="0.8" |
| 66 | 66 |
android:paddingLeft="15dp" |
| 67 |
android:text="Radius"
|
|
| 67 |
android:text="@string/radius"
|
|
| 68 | 68 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
| 69 | 69 |
|
| 70 | 70 |
<SeekBar |
| src/main/res/layout/effect1d.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="vertical"> |
| 7 | 7 |
|
| 8 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
| 8 |
<LinearLayout |
|
| 9 | 9 |
android:id="@+id/button1dLayout" |
| 10 | 10 |
android:layout_width="match_parent" |
| 11 | 11 |
android:layout_height="match_parent" |
| src/main/res/layout/effect2d.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="vertical"> |
| 7 | 7 |
|
| 8 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
| 8 |
<LinearLayout |
|
| 9 | 9 |
android:id="@+id/button2dLayout" |
| 10 | 10 |
android:layout_width="match_parent" |
| 11 | 11 |
android:layout_height="match_parent" |
| src/main/res/layout/effect3d.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="vertical"> |
| 7 | 7 |
|
| 8 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
| 8 |
<LinearLayout |
|
| 9 | 9 |
android:id="@+id/button3dLayout" |
| 10 | 10 |
android:layout_width="match_parent" |
| 11 | 11 |
android:layout_height="match_parent" |
| src/main/res/layout/effect4d.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="vertical"> |
| 7 | 7 |
|
| 8 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
| 8 |
<LinearLayout |
|
| 9 | 9 |
android:id="@+id/button4dLayout" |
| 10 | 10 |
android:layout_width="match_parent" |
| 11 | 11 |
android:layout_height="match_parent" |
| src/main/res/layout/effect5d.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="vertical"> |
| 7 | 7 |
|
| 8 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
| 8 |
<LinearLayout |
|
| 9 | 9 |
android:id="@+id/button5dLayout" |
| 10 | 10 |
android:layout_width="match_parent" |
| 11 | 11 |
android:layout_height="match_parent" |
| src/main/res/layout/genericlayout.xml | ||
|---|---|---|
| 58 | 58 |
android:layout_height="0dp" |
| 59 | 59 |
android:layout_weight="1" /> |
| 60 | 60 |
|
| 61 |
<android.support.design.widget.TabLayout
|
|
| 61 |
<com.google.android.material.tabs.TabLayout
|
|
| 62 | 62 |
android:id="@+id/generic_sliding_tabs" |
| 63 | 63 |
android:layout_width="match_parent" |
| 64 | 64 |
android:layout_height="32dp" |
| 65 | 65 |
android:theme="@style/Theme.AppCompat.NoActionBar"> |
| 66 |
</android.support.design.widget.TabLayout>
|
|
| 66 |
</com.google.android.material.tabs.TabLayout>
|
|
| 67 | 67 |
|
| 68 |
<android.support.v4.view.ViewPager
|
|
| 68 |
<androidx.viewpager.widget.ViewPager
|
|
| 69 | 69 |
android:id="@+id/generic_viewpager" |
| 70 | 70 |
android:layout_width="match_parent" |
| 71 | 71 |
android:layout_height="0dp" |
| src/main/res/layout/glowlayout.xml | ||
|---|---|---|
| 23 | 23 |
android:layout_height="wrap_content" |
| 24 | 24 |
android:layout_weight="0.5" |
| 25 | 25 |
android:gravity="center_vertical|center" |
| 26 |
android:text="@string/glow_radius"
|
|
| 26 |
android:text="@string/radius" |
|
| 27 | 27 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
| 28 | 28 |
|
| 29 | 29 |
<SeekBar |
| src/main/res/layout/toc_item.xml | ||
|---|---|---|
| 5 | 5 |
android:layout_height="wrap_content" |
| 6 | 6 |
android:orientation="horizontal" |
| 7 | 7 |
android:paddingTop="4dp" |
| 8 |
android:paddingBottom="4dp"> |
|
| 8 |
android:paddingBottom="4dp"> |
|
| 9 |
|
|
| 9 | 10 |
<ImageView |
| 10 | 11 |
android:id="@+id/Image" |
| 11 | 12 |
android:layout_width="wrap_content" |
| 12 | 13 |
android:layout_height="wrap_content" |
| 13 | 14 |
android:layout_margin="8dp" |
| 14 | 15 |
android:background="@drawable/icon_border"/> |
| 16 |
|
|
| 15 | 17 |
<LinearLayout |
| 16 | 18 |
android:layout_width="0dp" |
| 17 | 19 |
android:layout_height="wrap_content" |
| src/main/res/values/strings.xml | ||
|---|---|---|
| 21 | 21 |
<string name="type_fragment">Fragment</string> |
| 22 | 22 |
<string name="type_postprocess">Postprocess</string> |
| 23 | 23 |
|
| 24 |
<string name="glow_radius">Radius</string>
|
|
| 24 |
<string name="radius">Radius</string> |
|
| 25 | 25 |
<string name="glow_alpha">Alpha</string> |
| 26 | 26 |
<string name="continu">Continue</string> |
| 27 | 27 |
<string name="rows">Rows</string> |
Also available in: Unified diff
Move to AndroidX, target API level 29.