Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 6a74cc7

Browse files
Add files via upload
1 parent e2059e0 commit 6a74cc7

File tree

9 files changed

+567
-0
lines changed

9 files changed

+567
-0
lines changed
16 KB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.beeware.android;
2+
3+
public class DrawHandlerView extends android.view.View {
4+
private IDrawHandler drawHandler = null;
5+
6+
public DrawHandlerView(android.content.Context context) {
7+
super(context);
8+
}
9+
10+
public void setDrawHandler(IDrawHandler drawHandler) {
11+
this.drawHandler = drawHandler;
12+
}
13+
14+
public void onDraw(android.graphics.Canvas canvas) {
15+
super.onDraw(canvas);
16+
drawHandler.handleDraw(canvas);
17+
}
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.beeware.android;
2+
3+
public interface IDrawHandler {
4+
public void handleDraw(android.graphics.Canvas canvas);
5+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.beeware.android;
2+
3+
import android.content.Intent;
4+
import android.content.res.Configuration;
5+
import android.view.Menu;
6+
import android.view.MenuItem;
7+
8+
public interface IPythonApp {
9+
void onCreate();
10+
void onResume();
11+
void onStart();
12+
void onActivityResult(int requestCode, int resultCode, Intent data);
13+
void onConfigurationChanged(Configuration newConfig);
14+
boolean onOptionsItemSelected(MenuItem menuitem);
15+
boolean onPrepareOptionsMenu(Menu menu);
16+
// There's no need to add any more methods to this interface, as the Python
17+
// call mechanism no longer uses it.
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.beeware.android;
2+
3+
import android.app.Activity;
4+
import android.os.Build;
5+
import android.view.View;
6+
import android.view.ViewGroup;
7+
import android.widget.LinearLayout;
8+
9+
public class LTRConfig {
10+
11+
public static void applyLTR(Activity activity) {
12+
ViewGroup rootView = (ViewGroup) activity.findViewById(android.R.id.content);
13+
setLTR(rootView);
14+
}
15+
16+
private static void setLTR(ViewGroup viewGroup) {
17+
for (int i = 0; i < viewGroup.getChildCount(); i++) {
18+
View view = viewGroup.getChildAt(i);
19+
if (view instanceof ViewGroup) {
20+
setLTR((ViewGroup) view);
21+
}
22+
}
23+
24+
// اگر نسخه اندروید بالاتر از نوقا است، جهت LTR را تنظیم می‌کنیم
25+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
26+
viewGroup.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
27+
}
28+
}
29+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.beeware.android;
2+
3+
import android.content.Context;
4+
import android.os.Environment;
5+
import java.io.File;
6+
import java.io.IOException;
7+
import java.util.logging.FileHandler;
8+
import java.util.logging.Handler;
9+
import java.util.logging.Level;
10+
import java.util.logging.Logger;
11+
import java.util.logging.SimpleFormatter;
12+
13+
public class LoggingConfig {
14+
15+
public static void setup(Context context) {
16+
String logPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download/wwarpscanner/app_java.txt";
17+
File logFile = new File(logPath);
18+
19+
if (logFile.exists()) {
20+
logFile.delete();
21+
}
22+
23+
try {
24+
if (logFile.createNewFile()) {
25+
Handler fileHandler = new FileHandler(logPath, true);
26+
fileHandler.setFormatter(new SimpleFormatter());
27+
Logger logger = Logger.getLogger(context.getPackageName());
28+
logger.addHandler(fileHandler);
29+
logger.setLevel(Level.ALL);
30+
Logger.getLogger("").addHandler(fileHandler); // Add handler to root logger
31+
}
32+
} catch (IOException e) {
33+
e.printStackTrace();
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)