Skip to content

Commit

Permalink
Merge pull request #1 from glass-notes/p13i/fix-build-issues
Browse files Browse the repository at this point in the history
Fix build issues
  • Loading branch information
p13i committed Jul 11, 2019
2 parents 4437d01 + bac67ed commit e122194
Show file tree
Hide file tree
Showing 48 changed files with 202 additions and 173 deletions.
9 changes: 6 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 0 additions & 45 deletions app/build.gradle

This file was deleted.

Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
5 changes: 0 additions & 5 deletions app/src/main/res/values/colors.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/values/styles.xml

This file was deleted.

16 changes: 10 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@

buildscript {
repositories {
google()
jcenter()

maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()

maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions glass/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.application'

repositories {
jcenter()
flatDir {
dirs 'prebuilt-libs'
}
}

android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "io.p13i.glassnotes.template"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')

compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
}
8 changes: 6 additions & 2 deletions app/proguard-rules.pro → glass/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration mFiles using the
# proguardFiles setting in build.gradle.
# By default, the flags in this file are appended to flags specified
# in /home/theo/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<?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.p13i.glassnotes">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activities.EditActivity" />
<activity android:name=".activities.MainActivity">
android:theme="@style/AppTheme">
<activity
android:name="io.p13i.glassnotes.activities.MainActivity"
android:immersive="true"
android:icon="@drawable/ic_glass_logo"
android:label="@string/title_activity_glass_main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>

<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger" />
</activity>
<activity android:name=".activities.EditActivity" />
</application>

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

</manifest>
</manifest>
Binary file added glass/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.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
import java.util.Timer;
import java.util.TimerTask;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.p13i.glassnotes.models.Note;
import io.p13i.glassnotes.R;
import io.p13i.glassnotes.models.Note;
import io.p13i.glassnotes.datastores.GlassNotesDataStore;
import io.p13i.glassnotes.datastores.github.GlassNotesGitHubAPIClient;
import io.p13i.glassnotes.ui.StatusTextView;
Expand All @@ -30,10 +28,8 @@ public class EditActivity extends Activity {

public final static String TAG = EditActivity.class.getName();

@BindView(R.id.activity_edit_status)
StatusTextView mStatusTextView;

@BindView(R.id.note_edit_text)
EditText mNoteEditText;

private Note mNote;
Expand All @@ -49,7 +45,8 @@ protected void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.activity_edit);
ButterKnife.bind(this);
mStatusTextView = (StatusTextView) findViewById(R.id.activity_edit_status);
mNoteEditText = (EditText) findViewById(R.id.note_edit_text);

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Expand All @@ -65,16 +62,19 @@ protected void onCreate(Bundle savedInstanceState) {
mGlassNotesDataStore = Preferences.getUserPreferredDataStore(this);
mGlassNotesDataStore.getNote(mNote.getId(), new GlassNotesGitHubAPIClient.Promise<Note>() {
@Override
public void resolved(Note data) {
runOnUiThread(() -> {
mNote = data;
mNoteEditText.setText(mNote.getContent());
// Scroll to the end of the file
mNoteEditText.setSelection(mNoteEditText.getText().length());
// Allow editing
mNoteEditText.setEnabled(true);
// Save on an interval
startSaveTimer();
public void resolved(final Note data) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mNote = data;
mNoteEditText.setText(mNote.getContent());
// Scroll to the end of the file
mNoteEditText.setSelection(mNoteEditText.getText().length());
// Allow editing
mNoteEditText.setEnabled(true);
// Save on an interval
startSaveTimer();
}
});
}

Expand Down Expand Up @@ -143,9 +143,12 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
*/
private void saveAndFinish() {
// Update the UI
runOnUiThread(() -> {
mStatusTextView.setText(R.string.activity_edit_saving_existing);
mStatusTextView.invalidate(); // forces update
runOnUiThread(new Runnable() {
@Override
public void run() {
mStatusTextView.setText(R.string.activity_edit_saving_existing);
mStatusTextView.invalidate(); // forces update
}
});

// Clear the timer
Expand Down Expand Up @@ -183,7 +186,12 @@ public void run() {
saveNote(new GlassNotesGitHubAPIClient.Promise<Note>() {
@Override
public void resolved(Note data) {
runOnUiThread(() -> mStatusTextView.setStatus("Saved: " + DateUtilities.nowAs("KK:mm:ss a")));
runOnUiThread(new Runnable() {
@Override
public void run() {
mStatusTextView.setStatus("Saved: " + DateUtilities.nowAs("KK:mm:ss a"));
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
import java.util.Date;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.p13i.glassnotes.models.Note;
import io.p13i.glassnotes.R;
import io.p13i.glassnotes.models.Note;
import io.p13i.glassnotes.datastores.GlassNotesDataStore;
import io.p13i.glassnotes.datastores.github.GlassNotesGitHubAPIClient;
import io.p13i.glassnotes.ui.StatusTextView;
Expand All @@ -40,10 +38,8 @@ public class MainActivity extends Activity implements SelectableTextViewsManager

private final static String TAG = MainActivity.class.getName();

@BindView(R.id.activity_edit_status)
StatusTextView mStatusTextView;

@BindView(R.id.activity_main_layout)
LinearLayout mLinearLayout;

GestureDetector mGestureDetector;
Expand All @@ -62,7 +58,9 @@ protected void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mStatusTextView = (StatusTextView) findViewById(R.id.activity_edit_status);
mLinearLayout = (LinearLayout) findViewById(R.id.activity_main_layout);


getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Expand Down Expand Up @@ -91,7 +89,7 @@ void reloadNotes() {
@Override
public void resolved(List<Note> data) {
mNotes = data;
mLimitedViewItemManager = new LimitedViewItemManager<>(mNotes, /* maximumCount: */5);
mLimitedViewItemManager = new LimitedViewItemManager<Note>(mNotes, /* maximumCount: */5);
setVisibleNotes();
}

Expand All @@ -112,7 +110,7 @@ void clearNotesFromView() {
void setVisibleNotes() {
// Populate again
List<Note> visibleNotes = mLimitedViewItemManager.getVisibleItems();
for (Note note : visibleNotes) {
for (final Note note : visibleNotes) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -311,4 +309,4 @@ public void playSound(int sound) {
AudioManager audio = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(sound);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Gist implements Serializable {
public Map<String, File> mFiles;

public File getFirstFile() {
List<String> filenames = new ArrayList<>(mFiles.keySet());
List<String> filenames = new ArrayList<String>(mFiles.keySet());
return mFiles.get(filenames.get(0));
}

Expand All @@ -33,7 +33,7 @@ public Note asNote() {
}

public List<Note> asNotes() {
List<Note> notes = new ArrayList<>();
List<Note> notes = new ArrayList<Note>();
for (Map.Entry<String, File> kv : mFiles.entrySet()) {
notes.add(new Note(mId, kv.getValue().mFilename, kv.getValue().mContent, mCreatedAt, mUpdatedAt));
}
Expand Down
Loading

0 comments on commit e122194

Please sign in to comment.