Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mojabyte committed Sep 6, 2021
0 parents commit 423d49f
Show file tree
Hide file tree
Showing 71 changed files with 6,302 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

release/
/app/release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/

# Keystore files
*.jks
*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VIRec
34 changes: 34 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
defaultConfig {
applicationId "io.a3dv.VIRec"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation "androidx.preference:preference:1.1.1"
implementation 'androidx.appcompat:appcompat:1.3.1'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
52 changes: 52 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.a3dv.VIRec">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />

<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat">
<activity
android:name=".SettingsActivity"
android:exported="true"
android:label="@string/title_settings"
android:parentActivityName="io.a3dv.VIRec.CameraActivity" />
<activity
android:name=".ImuViewerActivity"
android:exported="true"
android:label="@string/title_imu"
android:parentActivityName="io.a3dv.VIRec.CameraActivity" />
<activity
android:name=".AboutActivity"
android:exported="true"
android:label="@string/title_about"
android:parentActivityName="io.a3dv.VIRec.CameraActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CameraActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
</application>

</manifest>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions app/src/main/java/io/a3dv/VIRec/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.a3dv.VIRec;

import android.os.Bundle;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class AboutActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about_activity);

TextView hyperlink = findViewById(R.id.linkTextView);
String linkText = getResources().getString(R.string.link_foreword);
Spanned text = FileHelper.fromHtml(linkText + " " +
"<a href='https://github.com/A3DV/VIRec'>GitHub</a>.");
hyperlink.setMovementMethod(LinkMovementMethod.getInstance());
hyperlink.setText(text);

TextView versionName = findViewById(R.id.versionText);
versionName.setText(getString(R.string.versionName, BuildConfig.VERSION_NAME));
}
}
71 changes: 71 additions & 0 deletions app/src/main/java/io/a3dv/VIRec/AspectFrameLayout.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package io.a3dv.VIRec;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

import timber.log.Timber;

/**
* Layout that adjusts to maintain a specific aspect ratio.
*/
public class AspectFrameLayout extends FrameLayout {
private double mTargetAspect = -1.0; // initially use default window size

public AspectFrameLayout(Context context) {
super(context);
}

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

/**
* Sets the desired aspect ratio. The value is <code>width / height</code>.
*/
public void setAspectRatio(double aspectRatio) {
if (aspectRatio < 0) {
throw new IllegalArgumentException();
}
Timber.d("Setting aspect ratio to %f (was %f)", aspectRatio, mTargetAspect);
if (mTargetAspect != aspectRatio) {
mTargetAspect = aspectRatio;
requestLayout();
}
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Target aspect ratio will be < 0 if it hasn't been set yet. In that case,
// we just use whatever we've been handed.
if (mTargetAspect > 0) {
int initialWidth = MeasureSpec.getSize(widthMeasureSpec);
int initialHeight = MeasureSpec.getSize(heightMeasureSpec);

// factor the padding out
int horizPadding = getPaddingLeft() + getPaddingRight();
int vertPadding = getPaddingTop() + getPaddingBottom();
initialWidth -= horizPadding;
initialHeight -= vertPadding;

double viewAspectRatio = (double) initialWidth / initialHeight;
double aspectDiff = mTargetAspect / viewAspectRatio - 1;

if (Math.abs(aspectDiff) >= 0.01) {
if (aspectDiff > 0) {
// limited by narrow width; restrict height
initialHeight = (int) (initialWidth / mTargetAspect);
} else {
// limited by short height; restrict width
initialWidth = (int) (initialHeight * mTargetAspect);
}
initialWidth += horizPadding;
initialHeight += vertPadding;
widthMeasureSpec = MeasureSpec.makeMeasureSpec(initialWidth, MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(initialHeight, MeasureSpec.EXACTLY);
}
}

super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
Loading

0 comments on commit 423d49f

Please sign in to comment.