Fix new suggestion list selection

This commit is contained in:
Tanguy Herbron 2018-02-16 09:01:39 +01:00
parent 375afee570
commit 76dfa0cacd
5 changed files with 44 additions and 5 deletions

View File

@ -44,5 +44,5 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('C:/Users/Guitoune/Documents/GitHub/Coinfolio/libs/binance-api.jar') implementation files('../libs/binance-api.jar')
} }

View File

@ -15,7 +15,8 @@
android:name=".Activities.HomeActivity" android:name=".Activities.HomeActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -28,14 +29,26 @@
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".Activities.CurrencySelectionActivity" android:name=".Activities.CurrencySelectionActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.nauk.coinfolio.Activities.HomeActivity"/>
</activity>
<activity <activity
android:name=".Activities.RecordTransactionActivity" android:name=".Activities.RecordTransactionActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.nauk.coinfolio.Activities.HomeActivity"/>
</activity>
<activity <activity
android:name=".Activities.CurrencyDetailsActivity" android:name=".Activities.CurrencyDetailsActivity"
android:label="@string/title_activity_currency_details" android:label="@string/title_activity_currency_details"
android:screenOrientation="portrait" /> android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.nauk.coinfolio.Activities.HomeActivity"/>
</activity>
</application> </application>
</manifest> </manifest>

View File

@ -5,6 +5,7 @@ import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView; import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -82,6 +83,17 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
finish(); finish();
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -2,6 +2,7 @@ package com.nauk.coinfolio.Activities;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -84,6 +85,18 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
listView.setAdapter(adapter); listView.setAdapter(adapter);
listView.setTextFilterEnabled(false); listView.setTextFilterEnabled(false);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Currency selectedCurrency = (Currency) adapterView.getItemAtPosition(i);
Intent intent = new Intent(CurrencySelectionActivity.this, RecordTransactionActivity.class);
intent.putExtra("coin", selectedCurrency.getName());
intent.putExtra("symbol", selectedCurrency.getSymbol());
startActivity(intent);
finish();
}
});
filter = adapter.getFilter(); filter = adapter.getFilter();
} }

View File

@ -140,5 +140,6 @@
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string> <string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
<string name="currencyDollarPlaceholder">US$%1$s</string> <string name="currencyDollarPlaceholder">US$%1$s</string>
<string name="currencyPercentagePlaceholder">%1$s%%</string> <string name="currencyPercentagePlaceholder">%1$s%%</string>
<string name="title_activity_main">MainActivity</string>
</resources> </resources>