Minor Tweaks

Signed-off-by: Priyank Shankar <shankarpriyank312002@gmail.com>
This commit is contained in:
Priyank Shankar 2022-06-27 17:10:25 +05:30
parent 1fc211b81d
commit ba402a4e26
2 changed files with 25 additions and 8 deletions

View file

@ -18,6 +18,12 @@ import androidx.car.app.navigation.NavigationManager;
import androidx.car.app.navigation.model.NavigationTemplate;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MapFragment;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.settings.StoragePathManager;
import com.mapswithme.util.StorageUtils;
import com.mapswithme.util.UiUtils;
import java.io.IOException;
import static androidx.car.app.model.Action.BACK;
@ -36,20 +42,29 @@ public class HelloWorldScreen extends Screen implements SurfaceCallback
@NonNull
@Override
public Template onGetTemplate()
{
{ Log.e("Show Up","Shows Up");
NavigationTemplate.Builder builder = new NavigationTemplate.Builder();
Action back = BACK;
ActionStrip.Builder actionStripBuilder = new ActionStrip.Builder();
actionStripBuilder.addAction(back).addAction(new Action.Builder().setTitle("Test").build());
actionStripBuilder.addAction(new Action.Builder().setTitle("Exit").setOnClickListener(this::exit).build());
builder.setActionStrip(actionStripBuilder.build());
NavigationManager navigationManager = getCarContext().getCarService(NavigationManager.class);
return builder.build();
}
private void exit() {
getCarContext().finishCarApp();
}
@Override
public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer)
{
MwmApplication cat = MwmApplication.from(getCarContext());
try
{
cat.initNativePlatform();
}
catch (IOException e)
{
e.printStackTrace();
}
int h = surfaceContainer.getHeight();
int w = surfaceContainer.getWidth();
Canvas canvas = null;

View file

@ -100,12 +100,13 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
return context.getSharedPreferences(context.getString(R.string.pref_file_name), MODE_PRIVATE);
}
@Override
public void onCreate()
{
super.onCreate();
mLogger.i(TAG, "Initializing application");
Log.i("Native", "Initializing application");
LoggerFactory.INSTANCE.initFileLogging(this);
// Set configuration directory as early as possible.
@ -147,7 +148,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
initNativeFramework();
}
private void initNativePlatform() throws IOException
public void initNativePlatform() throws IOException
{
if (mPlatformInitialized)
return;
@ -178,6 +179,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
Editor.init(this);
mPlatformInitialized = true;
Log.i("Native", "Initializing application");
mLogger.i(TAG, "Platform initialized");
}
@ -266,7 +268,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
}
private static native void nativeSetSettingsDir(String settingsPath);
private native void nativeInitPlatform(String apkPath, String writablePath, String privatePath,
public native void nativeInitPlatform(String apkPath, String writablePath, String privatePath,
String tmpPath, String flavorName, String buildType,
boolean isTablet);
private static native void nativeInitFramework();