Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketchware project #2

Merged
merged 11 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions app/build/bin/injected/AndroidManifest.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/build/bin/injected/gen/com/my/newproject/BuildConfig.java

This file was deleted.

Binary file removed app/build/bin/res/drawable-xhdpi/app_icon.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/build/bin/res/drawable-xhdpi/default_image.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/build/bin/res/drawable-xhdpi/ji1.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/build/bin/res/drawable-xhdpi/xoc.png
Binary file not shown.
6 changes: 0 additions & 6 deletions app/build/gen/com/my/newproject/BuildConfig.java

This file was deleted.

20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.newproject">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:label="积木编程"
android:icon="@drawable/app_icon"
android:largeHeap="true"
android:name=".SketchApplication"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
Expand All @@ -32,5 +37,20 @@
android:name=".FunctionListActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"/>
<activity
android:name=".DialogContextActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"/>
<activity
android:name=".CustomlanguageActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"/>
<activity
android:name=".AboutActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"/>
<activity
android:name=".DebugActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
209 changes: 209 additions & 0 deletions app/src/main/java/com/my/newproject/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
package com.my.newproject;

import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.content.*;
import android.graphics.*;
import android.media.*;
import android.net.*;
import android.text.*;
import android.util.*;
import android.webkit.*;
import android.animation.*;
import android.view.animation.*;
import java.util.*;
import java.text.*;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.widget.Button;
import android.content.Intent;
import android.net.Uri;
import android.media.MediaPlayer;
import android.view.View;
import android.webkit.WebViewClient;
import android.content.ClipData;
import android.content.ClipboardManager;

public class AboutActivity extends AppCompatActivity {


private Toolbar _toolbar;

private LinearLayout linear1;
private TextView textview1;
private TextView connect;
private TextView textview2;
private LinearLayout linear2;
private WebView webview1;
private Button button1;
private Button button2;
private Button button3;

private Intent i = new Intent();
private MediaPlayer bgm;
@Override
protected void onCreate(Bundle _savedInstanceState) {
super.onCreate(_savedInstanceState);
setContentView(R.layout.about);
initialize(_savedInstanceState);
initializeLogic();
}

private void initialize(Bundle _savedInstanceState) {

_toolbar = (Toolbar) findViewById(R.id._toolbar);
setSupportActionBar(_toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
_toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v) {
onBackPressed();
}
});
linear1 = (LinearLayout) findViewById(R.id.linear1);
textview1 = (TextView) findViewById(R.id.textview1);
connect = (TextView) findViewById(R.id.connect);
textview2 = (TextView) findViewById(R.id.textview2);
linear2 = (LinearLayout) findViewById(R.id.linear2);
webview1 = (WebView) findViewById(R.id.webview1);
webview1.getSettings().setJavaScriptEnabled(true);
webview1.getSettings().setSupportZoom(true);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);

connect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _view) {
((ClipboardManager) getSystemService(getApplicationContext().CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("clipboard", textview1.getText().toString()));
SketchwareUtil.showMessage(getApplicationContext(), "已复制信息到粘贴板");
}
});

webview1.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView _param1, String _param2, Bitmap _param3) {
final String _url = _param2;
SketchwareUtil.showMessage(getApplicationContext(), "启动😃");
super.onPageStarted(_param1, _param2, _param3);
}

@Override
public void onPageFinished(WebView _param1, String _param2) {
final String _url = _param2;
SketchwareUtil.showMessage(getApplicationContext(), "完成😜");
super.onPageFinished(_param1, _param2);
}
});

button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _view) {
webview1.loadUrl("https://space.bilibili.com/26680057?share_medium=android&share_source=copy_link&bbid=AWIANlRjVWBWMFNnGykbKRstTywdf00sSTUBinfoc&ts=1593620681111");
}
});

button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _view) {
webview1.loadUrl("https://github.com/2439905184");
}
});

button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _view) {
webview1.loadUrl("https://github.com/orgs/little-game-and-simple-software/dashboard");
}
});
}
private void initializeLogic() {
webview1.loadUrl("https://github.com/2439905184");
}

@Override
protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) {
super.onActivityResult(_requestCode, _resultCode, _data);

switch (_requestCode) {

default:
break;
}
}

@Override
public void onStart() {
super.onStart();
bgm = MediaPlayer.create(getApplicationContext(), R.raw.bgm_true);
bgm.setLooping(true);
bgm.start();
}

@Override
public void onBackPressed() {
bgm.setLooping(false);
bgm.reset();
bgm.pause();
bgm.release();
}
@Deprecated
public void showMessage(String _s) {
Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show();
}

@Deprecated
public int getLocationX(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[0];
}

@Deprecated
public int getLocationY(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[1];
}

@Deprecated
public int getRandom(int _min, int _max) {
Random random = new Random();
return random.nextInt(_max - _min + 1) + _min;
}

@Deprecated
public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list) {
ArrayList<Double> _result = new ArrayList<Double>();
SparseBooleanArray _arr = _list.getCheckedItemPositions();
for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
if (_arr.valueAt(_iIdx))
_result.add((double)_arr.keyAt(_iIdx));
}
return _result;
}

@Deprecated
public float getDip(int _input){
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics());
}

@Deprecated
public int getDisplayWidthPixels(){
return getResources().getDisplayMetrics().widthPixels;
}

@Deprecated
public int getDisplayHeightPixels(){
return getResources().getDisplayMetrics().heightPixels;
}

}
Loading