Demo add devkit button

This commit is contained in:
pengfei.zhou
2021-07-14 11:51:45 +08:00
committed by osborn
parent 47022fe715
commit 0dfe0d73be
5 changed files with 67 additions and 3 deletions

View File

@@ -13,7 +13,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".PullableActivity"></activity>
<activity android:name=".PullableActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -21,6 +21,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DoricDebugActivity"
android:theme="@style/Theme.Design.Light.NoActionBar" />
</application>
</manifest>

View File

@@ -0,0 +1,53 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package pub.doric.demo;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import pub.doric.DoricActivity;
import pub.doric.devkit.DoricDev;
import pub.doric.navbar.BaseDoricNavBar;
/**
* @Description: pub.doric.demo
* @Author: pengfei.zhou
* @CreateDate: 2021/7/14
*/
public class DoricDebugActivity extends DoricActivity {
@Override
protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BaseDoricNavBar doricNavBar = findViewById(R.id.doric_nav_bar);
TextView textView = new TextView(this);
textView.setText("Devkit");
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DoricDev.getInstance().openDevMode();
}
});
textView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
doricNavBar.setRight(textView);
}
}

View File

@@ -118,7 +118,7 @@ public class MainActivity extends AppCompatActivity {
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(tv.getContext(), DoricActivity.class);
Intent intent = new Intent(tv.getContext(), DoricDebugActivity.class);
intent.putExtra("source", "assets://src/" + data[position - 1]);
intent.putExtra("alias", data[position - 1].replace(".js", ""));
tv.getContext().startActivity(intent);