-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded libs.
- Loading branch information
Showing
9 changed files
with
174 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Aug 02 02:35:59 EET 2017 | ||
#Fri Aug 25 18:12:12 EET 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
sample/src/main/java/com/huma/roomforasset/JavaActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.huma.roomforasset; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.TextView; | ||
|
||
import com.huma.room_for_asset.RoomAsset; | ||
import com.jakewharton.fliptables.FlipTableConverters; | ||
|
||
import java.util.List; | ||
|
||
public class JavaActivity extends AppCompatActivity { | ||
private static final String TAG = JavaActivity.class.getSimpleName(); | ||
|
||
private Button employeesButton; | ||
private Button customersButton; | ||
private TextView resultTextView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_java); | ||
initView(); | ||
|
||
final AppDatabase db = RoomAsset.databaseBuilder( | ||
getApplicationContext(), AppDatabase.class, "chinook.db").build(); | ||
|
||
|
||
employeesButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
new Thread(new Runnable() { | ||
@Override | ||
public void run() { | ||
final List<Employees> employees = db.chinookDao().getEmployees(); | ||
|
||
runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
resultTextView.setText( | ||
FlipTableConverters.fromIterable(employees, Employees.class)); | ||
} | ||
}); | ||
|
||
Log.d(TAG, "employees = " + employees); | ||
} | ||
}).start(); | ||
} | ||
}); | ||
|
||
customersButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
new Thread(new Runnable() { | ||
@Override | ||
public void run() { | ||
final List<Customers> customers = db.chinookDao().getCustomers(); | ||
|
||
runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
resultTextView.setText( | ||
FlipTableConverters.fromIterable(customers, Customers.class)); | ||
} | ||
}); | ||
Log.d(TAG, "customers = " + customers); | ||
} | ||
}).start(); | ||
|
||
} | ||
}); | ||
} | ||
|
||
private void initView() { | ||
employeesButton = findViewById(R.id.employeesButton); | ||
customersButton = findViewById(R.id.customersButton); | ||
resultTextView = findViewById(R.id.resultTextView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ScrollView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<HorizontalScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<android.support.constraint.ConstraintLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
tools:context="com.huma.roomasset.MainActivity"> | ||
|
||
<Button | ||
android:id="@+id/employeesButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="152dp" | ||
android:layout_marginStart="152dp" | ||
android:text="employees" | ||
app:layout_constraintBaseline_toBaselineOf="@+id/customersButton" | ||
app:layout_constraintStart_toEndOf="@+id/customersButton"/> | ||
|
||
<Button | ||
android:id="@+id/customersButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="8dp" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginTop="8dp" | ||
android:text="customers" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
|
||
<TextView | ||
android:id="@+id/resultTextView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="8dp" | ||
android:layout_marginEnd="8dp" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginTop="100dp" | ||
android:text="Result" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.0" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="1.0"/> | ||
|
||
</android.support.constraint.ConstraintLayout> | ||
</HorizontalScrollView> | ||
</ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<item | ||
android:id="@+id/action_open_java_activity" | ||
android:title="Open Java Activity" | ||
app:showAsAction="ifRoom"/> | ||
</menu> |