-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chroe: update demo, add more samples
- Loading branch information
Showing
58 changed files
with
1,053 additions
and
1,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
demo/src/main/java/com/bytedance/scenedemo/ActivityCompatibilitySamples.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.bytedance.scenedemo | ||
|
||
import android.Manifest | ||
import android.content.Intent | ||
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.LinearLayout | ||
import android.widget.ScrollView | ||
import android.widget.Toast | ||
import com.bytedance.scene.Scene | ||
import com.bytedance.scene.interfaces.PermissionResultCallback | ||
import com.bytedance.scene.ktx.requestPermissions | ||
import com.bytedance.scenedemo.activity_compatibility.activity_result.SceneGetActivityResultSample | ||
import com.bytedance.scenedemo.activity_compatibility.configuration.ConfigurationDemoScene | ||
import com.bytedance.scenedemo.activity_compatibility.softkeyboard.SoftKeyboardDemoScene | ||
import com.bytedance.scenedemo.activity_compatibility.theme.ThemeDemo | ||
import com.bytedance.scenedemo.activity_compatibility.window.WindowDemo | ||
import com.bytedance.scenedemo.activity_compatibility.scene_result.ActivityGetSceneResultSampleActivity | ||
import com.bytedance.scenedemo.utility.addButton | ||
import com.bytedance.scenedemo.utility.addClassPathTitle | ||
import com.bytedance.scenedemo.utility.addSpace | ||
import com.bytedance.scenedemo.utility.addTitle | ||
|
||
|
||
class ActivityCompatibilitySamples : Scene() { | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?): View { | ||
val scrollView = ScrollView(requireSceneContext()) | ||
|
||
val layout = LinearLayout(requireSceneContext()) | ||
layout.orientation = LinearLayout.VERTICAL | ||
|
||
scrollView.addView(layout) | ||
|
||
addClassPathTitle(layout) | ||
addSpace(layout, 12) | ||
addTitle(layout, getString(R.string.main_title_basic)) | ||
|
||
addButton(layout, getString(R.string.main_activity_btn_scene_get_activity_result), View.OnClickListener { | ||
requireNavigationScene().push(SceneGetActivityResultSample::class.java) | ||
}) | ||
addButton(layout, getString(R.string.main_activity_btn_activity_get_scene_result), View.OnClickListener { | ||
requireNavigationScene().startActivity(Intent(requireActivity(), ActivityGetSceneResultSampleActivity::class.java)) | ||
}) | ||
addButton(layout, getString(R.string.nav_result_permission), View.OnClickListener { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 123, PermissionResultCallback { | ||
if (it != null && it.isNotEmpty() | ||
&& it[0] == PackageManager.PERMISSION_GRANTED) { | ||
Toast.makeText(activity, getString(R.string.nav_result_permission_tip_success), Toast.LENGTH_SHORT).show() | ||
} else { | ||
Toast.makeText(activity, getString(R.string.nav_result_permission_tip_failed), Toast.LENGTH_SHORT).show() | ||
} | ||
}) | ||
} | ||
}) | ||
addButton(layout, getString(R.string.main_nav_btn_configuration_change), View.OnClickListener { | ||
requireNavigationScene().push(ConfigurationDemoScene::class.java) | ||
}) | ||
addButton(layout, getString(R.string.main_nav_btn_ime), View.OnClickListener { | ||
requireNavigationScene().push(SoftKeyboardDemoScene::class.java) | ||
}) | ||
addButton(layout, getString(R.string.main_nav_btn_theme), View.OnClickListener { | ||
requireNavigationScene().push(ThemeDemo::class.java) | ||
}) | ||
|
||
addButton(layout, getString(R.string.main_nav_btn_modify_activity_states), View.OnClickListener { | ||
requireNavigationScene().push(WindowDemo::class.java) | ||
}) | ||
|
||
addSpace(layout, 100) | ||
|
||
return scrollView | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
demo/src/main/java/com/bytedance/scenedemo/DialogSamples.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.bytedance.scenedemo | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.LinearLayout | ||
import android.widget.ScrollView | ||
import android.widget.Toast | ||
import com.bytedance.scene.Scene | ||
import com.bytedance.scene.animation.animatorexecutor.DialogSceneAnimatorExecutor | ||
import com.bytedance.scene.interfaces.PushOptions | ||
import com.bytedance.scenedemo.dialog.DemoDialogScene | ||
import com.bytedance.scenedemo.dialog.DemoDialogWithDimScene | ||
import com.bytedance.scenedemo.utility.addButton | ||
import com.bytedance.scenedemo.utility.addClassPathTitle | ||
import com.bytedance.scenedemo.utility.addSpace | ||
import com.bytedance.scenedemo.utility.addTitle | ||
|
||
|
||
class DialogSamples : Scene() { | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?): View { | ||
val scrollView = ScrollView(activity) | ||
|
||
val layout = LinearLayout(activity) | ||
layout.orientation = LinearLayout.VERTICAL | ||
|
||
scrollView.addView(layout) | ||
|
||
addClassPathTitle(layout) | ||
addSpace(layout, 12) | ||
addTitle(layout, getString(R.string.main_title_basic)) | ||
|
||
addButton(layout, getString(R.string.part_dialog_btn_1), View.OnClickListener { | ||
requireNavigationScene().push(DemoDialogScene::class.java, null, PushOptions.Builder() | ||
.setTranslucent(true).setAnimation(DialogSceneAnimatorExecutor()).build()) | ||
}) | ||
addButton(layout, getString(R.string.part_dialog_btn_2), View.OnClickListener { | ||
requireNavigationScene().push(DemoDialogWithDimScene::class.java, null, PushOptions.Builder() | ||
.setTranslucent(true).setAnimation(DialogSceneAnimatorExecutor()).build()) | ||
}) | ||
addButton(layout, getString(R.string.part_dialog_btn_3), View.OnClickListener { | ||
Toast.makeText(requireApplicationContext(),"TODO",Toast.LENGTH_SHORT).show() | ||
}) | ||
addButton(layout, getString(R.string.main_part_btn_floating_window), View.OnClickListener { | ||
Toast.makeText(requireApplicationContext(),"TODO",Toast.LENGTH_SHORT).show() | ||
}) | ||
|
||
addSpace(layout, 100) | ||
|
||
return scrollView | ||
} | ||
} |
154 changes: 0 additions & 154 deletions
154
demo/src/main/java/com/bytedance/scenedemo/GroupListDemo.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.