Demo add devkit button
This commit is contained in:
parent
47022fe715
commit
0dfe0d73be
@ -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>
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -7,7 +7,9 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
|
||||
<application>
|
||||
<activity android:name=".ui.DoricDevActivity" android:exported="true"/>
|
||||
<activity
|
||||
android:name=".ui.DoricDevActivity"
|
||||
android:theme="@style/Theme.Design.Light.NoActionBar" />
|
||||
<activity android:name=".qrcode.activity.CaptureActivity" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -68,6 +68,10 @@ - (BOOL)isSimulator {
|
||||
return TARGET_OS_SIMULATOR == 1;
|
||||
}
|
||||
|
||||
- (void)onOpenDevkit {
|
||||
[[DoricDev instance] openDevMode];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.row == 0) {
|
||||
[[DoricDev instance] openDevMode:self];
|
||||
@ -79,6 +83,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
|
||||
alias:self.demoFilePaths[(NSUInteger) indexPath.row]
|
||||
extra:nil
|
||||
];
|
||||
UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"Devkit" style:UIBarButtonItemStylePlain target:self action:@selector(onOpenDevkit)];
|
||||
doricViewController.navigationItem.rightBarButtonItem = rightBarItem;
|
||||
[self.navigationController pushViewController:doricViewController animated:NO];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user