Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fab按钮的菜单项改为列表添加,方便在smali中单独删除
Browse files Browse the repository at this point in the history
  • Loading branch information
ewt45 committed May 26, 2023
1 parent 092fcee commit 7850fd9
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public WDesktop(){
}
@Override // com.eltechs.axs.configuration.startup.StartupAction
public void execute() {
requestUserInput(EDMainActivity.class);
requestUserInput(MainActivity.class);
// requestUserInput(
// QH.isTesting()
// ? MainActivity.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import com.example.datainsert.exagear.FAB.dialogfragment.DriveD;
import com.example.datainsert.exagear.RSIDHelper;

import java.util.ArrayList;
import java.util.List;

public class FabMenu {
private static final String TAG = "FabMenu";

Expand All @@ -44,7 +47,7 @@ public FabMenu(AppCompatActivity a) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(AndroidHelpers.dpToPx(60), AndroidHelpers.dpToPx(60));//AndroidHelpers.dpToPx(60),AndroidHelpers.dpToPx(60)
params.gravity = Gravity.TOP | Gravity.RIGHT;
params.rightMargin = AndroidHelpers.dpToPx(40);
fab.setTranslationY(-AndroidHelpers.dpToPx(120));//不知道为啥margin那里说应该是正数,那用translation吧
fab.setTranslationY(-AndroidHelpers.dpToPx(100));//不知道为啥margin那里说应该是正数,那用translation吧
fab.setElevation(100); //感觉高度舍不设置都无所谓
fab.setCustomSize(AndroidHelpers.dpToPx(60)); //要用这个设置一遍否则图片不居中
//设置图标
Expand All @@ -66,7 +69,10 @@ public FabMenu(AppCompatActivity a) {

//用于显示的功能对话框 这个class newInstance不会出问题吧
// Class<? extends BaseFragment> clz = DriveD.class;
final Class<? extends BaseFragment>[] fragmentClsArray = new Class[]{DriveD.class,CustomControls.class, AboutFab.class};
final List<Class<? extends BaseFragment>> fragmentClsArray = new ArrayList<>(); //使用add的添加方式,便于在smali中删除
fragmentClsArray.add(DriveD.class);
fragmentClsArray.add(CustomControls.class);
fragmentClsArray.add(AboutFab.class);
//先调用一次初次启动需要执行的操作
for (Class<? extends BaseFragment> clz : fragmentClsArray) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.datainsert.exagear.test;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.view.SurfaceView;

public class LorieView extends SurfaceView {
public LorieView(Context context) {
super(context);
}

public LorieView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public LorieView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

public LorieView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
try {
// SharedPreferences sp = getContext().getSharedPreferences("com.eltechs.ed.CONTAINER_CONFIG_0",Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
String ratioStr = sp.getString("full_screen_with_ratio","");
if(ratioStr!=null && ratioStr.contains(":") ){
String[] strings1 = ratioStr.split(":");
float ratio = Integer.parseInt(strings1[0])*1f/Integer.parseInt(strings1[1]);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
//左右黑边
if(width*1f/height > ratio){
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (width/ratio), MeasureSpec.EXACTLY);
}
//上下黑边
else{
widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) (height*ratio), MeasureSpec.EXACTLY);
}
}
}catch (Exception e){
e.printStackTrace();
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.ConstraintSet;
import android.support.v7.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Menu;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.LinearLayout;
import android.content.SharedPreferences;

public class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback {
static String TAG= "MySurfaceView";
Expand All @@ -34,9 +39,11 @@ public void surfaceCreated(SurfaceHolder holder) {
mDrawThread.start();
}


@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {


}

@Override
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/fragment_slideshow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
android:layout_width="match_parent"
android:layout_height="200dp"/>

<com.example.datainsert.exagear.test.MySurfaceView
<!-- <com.example.datainsert.exagear.test.MySurfaceView-->
<!-- android:id="@+id/surfaceview"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="200dp"/>-->
<com.example.datainsert.exagear.test.LorieView
android:id="@+id/surfaceview"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/layout/zzz_for_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="100dp"
android:text="TextView"
app:layout_constraintDimensionRatio="25:9"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
13 changes: 13 additions & 0 deletions app/src/main/res/xml/container_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,17 @@
android:targetClass="com.eltechs.axs.activities.XServerDisplayActivity"
android:targetPackage="com.eltechs.axs.activities" />
</PreferenceScreen>

<EditTextPreference
android:defaultValue="16:9"
android:summary="格式:宽:高,英文冒号隔开,没有英文冒号则拉伸全屏"
android:key="full_screen_with_ratio"
android:title="全屏宽高比" />

<EditTextPreference
android:title="Display resolution"
android:key="displayResolutionCustom"
android:defaultValue="1280x720"
android:summary="Example: 1280x1024" />

</PreferenceScreen>

0 comments on commit 7850fd9

Please sign in to comment.