Overhaul Theming System (Dark Mode Support) (#2443)
* refactor launcher background color * Remove redundant attrs * Fix input view alignment * Standardized typography and optimized them to enable theme overlays * Utilize colorPrimary * Apply theme color values to views * Fix misplaced separators * Add theming documentation * Refactor bottom navigation view * Add custom color references * Update naming and docs * Apply new theme to wallet connect ui * Update wallet connect session detail to match Zeplin spec * Adjust wallet connect dialog title style * Updated buttons to become round * Changed copytextview background colorpull/2464/head
parent
01897c9acc
commit
cb03caf3e2
After Width: | Height: | Size: 18 KiB |
@ -1,15 +0,0 @@ |
||||
package com.alphawallet.app.router; |
||||
|
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
|
||||
import com.alphawallet.app.ui.HelpActivity; |
||||
|
||||
public class HelpRouter { |
||||
public void open(Context context) { |
||||
Intent intent = new Intent(context, HelpActivity.class); |
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
||||
context.startActivity(intent); |
||||
} |
||||
} |
@ -1,188 +0,0 @@ |
||||
package com.alphawallet.app.ui; |
||||
|
||||
import android.content.Intent; |
||||
import android.net.Uri; |
||||
import android.os.Bundle; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.annotation.RawRes; |
||||
import androidx.recyclerview.widget.LinearLayoutManager; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
import android.util.Log; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
import android.webkit.WebView; |
||||
import android.widget.LinearLayout; |
||||
|
||||
import com.alphawallet.app.entity.MediaLinks; |
||||
import com.alphawallet.app.ui.widget.adapter.HelpAdapter; |
||||
|
||||
import com.alphawallet.app.R; |
||||
import com.alphawallet.app.entity.HelpItem; |
||||
import com.alphawallet.app.viewmodel.HelpViewModel; |
||||
|
||||
import java.io.InputStream; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import javax.inject.Inject; |
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint; |
||||
import timber.log.Timber; |
||||
|
||||
@AndroidEntryPoint |
||||
public class HelpActivity extends BaseActivity { |
||||
private HelpViewModel viewModel; |
||||
private WebView webView; |
||||
|
||||
@Override |
||||
protected void onCreate(@Nullable Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.fragment_help); |
||||
toolbar(); |
||||
setTitle(getString(R.string.toolbar_header_help)); |
||||
|
||||
RecyclerView list = findViewById(R.id.list_help); |
||||
list.setLayoutManager(new LinearLayoutManager(this)); |
||||
HelpAdapter adapter = new HelpAdapter(); |
||||
webView = findViewById(R.id.webview); |
||||
|
||||
/* Placeholder only */ |
||||
int[] questions = { |
||||
R.string.help_question1, |
||||
R.string.help_question2, |
||||
R.string.help_question3, |
||||
R.string.help_question4, |
||||
R.string.help_question5, |
||||
R.string.help_question6, |
||||
R.string.help_question7, |
||||
R.string.help_question8 |
||||
}; |
||||
|
||||
int[] answers = { |
||||
R.string.what_is_eth, |
||||
R.string.why_alphawallet_eth, |
||||
R.string.how_i_get_money, |
||||
R.string.what_is_seed_phrase, |
||||
R.string.how_i_transfer_into_wallet, |
||||
R.string.tokenscript_explaination, |
||||
R.string.privacy_policy, |
||||
R.string.terms_of_service |
||||
}; |
||||
|
||||
adapter.setWebView(webView); |
||||
List<HelpItem> helpItems = new ArrayList<>(); |
||||
for (int i = 0; i < questions.length; i++) { |
||||
if (isRawResource(answers[i])) |
||||
helpItems.add(new HelpItem(getString(questions[i]), answers[i])); |
||||
else if (getString(questions[i]).length() > 0) |
||||
helpItems.add(new HelpItem(getString(questions[i]), getString(answers[i]))); |
||||
} |
||||
adapter.setHelpItems(helpItems); |
||||
|
||||
list.setAdapter(adapter); |
||||
|
||||
final LinearLayout contactUs = findViewById(R.id.layout_contact); |
||||
contactUs.setOnClickListener(v -> { |
||||
helpIntent(); |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
if (item.getItemId() == android.R.id.home) { |
||||
if (hideWebView()) { |
||||
super.onOptionsItemSelected(item); |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void onBackPressed() { |
||||
if (hideWebView()) { |
||||
super.onBackPressed(); |
||||
} |
||||
} |
||||
|
||||
|
||||
private boolean hideWebView() { |
||||
if (webView.getVisibility() == View.VISIBLE) { |
||||
webView.setVisibility(View.GONE); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
private void helpIntent() { |
||||
final String at = "@"; |
||||
String uriText = |
||||
"mailto:" + MediaLinks.AWALLET_EMAIL1 + at + MediaLinks.AWALLET_EMAIL2 + |
||||
"?subject=" + Uri.encode(MediaLinks.AWALLET_SUBJECT) + |
||||
"&body=" + Uri.encode(""); |
||||
|
||||
Uri uri = Uri.parse(uriText); |
||||
|
||||
Intent emailIntent = new Intent(Intent.ACTION_SENDTO); |
||||
emailIntent.setData(uri); |
||||
startActivity(Intent.createChooser(emailIntent, "Send email")); |
||||
} |
||||
|
||||
public void onClick(View v) { |
||||
/* |
||||
// Create an instance of CognitoCachingCredentialsProvider
|
||||
CognitoCachingCredentialsProvider cognitoProvider = new CognitoCachingCredentialsProvider( |
||||
this.getApplicationContext(), "cn-north-1:44edb8ae-67c1-40de-b70d-ae9db5581e6e", Regions.CN_NORTH_1); |
||||
|
||||
// Create LambdaInvokerFactory, to be used to instantiate the Lambda proxy.
|
||||
LambdaInvokerFactory factory = new LambdaInvokerFactory(this.getApplicationContext(), |
||||
Regions.CN_NORTH_1, cognitoProvider); |
||||
|
||||
// Create the Lambda proxy object with a default Json data binder.
|
||||
// You can provide your own data binder by implementing
|
||||
// LambdaDataBinder.
|
||||
final TrustAddressGenerator AWSLambdaInterface = factory.build(TrustAddressGenerator.class); |
||||
|
||||
com.alphawallet.token.tools.TrustAddressGenerator.Request request = new com.alphawallet.token.tools.TrustAddressGenerator.Request("0x63cCEF733a093E5Bd773b41C96D3eCE361464942", "z+I6NxdALVtlc3TuUo2QEeV9rwyAmKB4UtQWkTLQhpE="); |
||||
// The Lambda function invocation results in a network call.
|
||||
// Make sure it is not called from the main thread.
|
||||
new AsyncTask<com.alphawallet.token.tools.TrustAddressGenerator.Request, Void, com.alphawallet.token.tools.TrustAddressGenerator.Response>() { |
||||
@Override |
||||
protected com.alphawallet.token.tools.TrustAddressGenerator.Response doInBackground(com.alphawallet.token.tools.TrustAddressGenerator.Request... params) { |
||||
// invoke the lambda method. In case it fails, it will throw a
|
||||
// LambdaFunctionException.
|
||||
try { |
||||
return AWSLambdaInterface.DeriveTrustAddress(params[0]); |
||||
} catch (LambdaFunctionException lfe) { |
||||
// please don't ignore such exception in production code!!
|
||||
Log.e("Tag", "Failed to invoke AWS Lambda" + lfe.getDetails(), lfe); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void onPostExecute(com.alphawallet.token.tools.TrustAddressGenerator.Response response) { |
||||
if (response == null) { |
||||
return; |
||||
} |
||||
|
||||
// Do a toast
|
||||
Toast.makeText(HelpActivity.this, response.getTrustAddress(), Toast.LENGTH_LONG).show(); |
||||
} |
||||
}.execute(request);*/ |
||||
} |
||||
|
||||
private boolean isRawResource(@RawRes int rawRes) { |
||||
try { |
||||
InputStream in = getResources().openRawResource(rawRes); |
||||
if (in.available() > 0) { |
||||
in.close(); |
||||
return true; |
||||
} |
||||
in.close(); |
||||
} catch (Exception ex) { |
||||
Timber.tag("READ_JS_TAG").d(ex, "Ex"); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
} |
@ -1,31 +0,0 @@ |
||||
package com.alphawallet.app.ui; |
||||
|
||||
import android.os.Bundle; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.fragment.app.Fragment; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.RelativeLayout; |
||||
|
||||
import com.alphawallet.app.R; |
||||
|
||||
|
||||
public class SearchFragment extends Fragment { |
||||
private View.OnClickListener listener; |
||||
|
||||
public void setCallbacks(View.OnClickListener listener) { |
||||
this.listener = listener; |
||||
} |
||||
|
||||
@Nullable |
||||
@Override |
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, |
||||
@Nullable Bundle savedInstanceState) { |
||||
View view = inflater.inflate(R.layout.fragment_search, container, false); |
||||
RelativeLayout layout = view.findViewById(R.id.layout); |
||||
layout.setOnClickListener(listener); |
||||
return view; |
||||
} |
||||
} |
@ -0,0 +1,79 @@ |
||||
package com.alphawallet.app.ui; |
||||
|
||||
import android.os.Bundle; |
||||
import android.widget.LinearLayout; |
||||
import android.widget.RadioGroup; |
||||
|
||||
import androidx.annotation.Nullable; |
||||
import androidx.lifecycle.ViewModelProvider; |
||||
|
||||
import com.alphawallet.app.C; |
||||
import com.alphawallet.app.R; |
||||
import com.alphawallet.app.viewmodel.SelectThemeViewModel; |
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint; |
||||
|
||||
@AndroidEntryPoint |
||||
public class SelectThemeActivity extends BaseActivity |
||||
{ |
||||
private SelectThemeViewModel viewModel; |
||||
|
||||
@Override |
||||
protected void onCreate(@Nullable Bundle savedInstanceState) |
||||
{ |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.activity_select_theme); |
||||
initViewModel(); |
||||
initViews(); |
||||
toolbar(); |
||||
setTitle(getString(R.string.title_select_theme)); |
||||
} |
||||
|
||||
private void initViewModel() |
||||
{ |
||||
viewModel = new ViewModelProvider(this).get(SelectThemeViewModel.class); |
||||
} |
||||
|
||||
private void initViews() |
||||
{ |
||||
LinearLayout lightThemeLayout = findViewById(R.id.layout_theme_light); |
||||
LinearLayout darkThemeLayout = findViewById(R.id.layout_theme_dark); |
||||
LinearLayout autoThemeLayout = findViewById(R.id.layout_theme_auto); |
||||
RadioGroup radioGroup = findViewById(R.id.radio_group); |
||||
|
||||
lightThemeLayout.setOnClickListener(v -> radioGroup.check(R.id.radio_theme_light)); |
||||
darkThemeLayout.setOnClickListener(v -> radioGroup.check(R.id.radio_theme_dark)); |
||||
autoThemeLayout.setOnClickListener(v -> radioGroup.check(R.id.radio_theme_auto)); |
||||
|
||||
int theme = viewModel.getTheme(); |
||||
if (theme == C.THEME_LIGHT) |
||||
{ |
||||
radioGroup.check(R.id.radio_theme_light); |
||||
} |
||||
else if (theme == C.THEME_DARK) |
||||
{ |
||||
radioGroup.check(R.id.radio_theme_dark); |
||||
} |
||||
else |
||||
{ |
||||
radioGroup.check(R.id.radio_theme_auto); |
||||
} |
||||
|
||||
radioGroup.setOnCheckedChangeListener((group, checkedId) -> |
||||
{ |
||||
if (checkedId == R.id.radio_theme_light) |
||||
{ |
||||
viewModel.setTheme(getApplicationContext(), C.THEME_LIGHT); |
||||
} |
||||
else if (checkedId == R.id.radio_theme_dark) |
||||
{ |
||||
viewModel.setTheme(getApplicationContext(), C.THEME_DARK); |
||||
} |
||||
else |
||||
{ |
||||
viewModel.setTheme(getApplicationContext(), C.THEME_AUTO); |
||||
} |
||||
finish(); |
||||
}); |
||||
} |
||||
} |
@ -1,188 +0,0 @@ |
||||
package com.alphawallet.app.ui.widget.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.os.Bundle; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
import android.view.ViewGroup; |
||||
|
||||
import com.alphawallet.app.R; |
||||
import com.alphawallet.app.entity.Wallet; |
||||
import com.alphawallet.app.entity.WalletType; |
||||
import com.alphawallet.app.interact.GenericWalletInteract; |
||||
import com.alphawallet.app.ui.widget.entity.WalletClickCallback; |
||||
import com.alphawallet.app.ui.widget.holder.BinderViewHolder; |
||||
import com.alphawallet.app.ui.widget.holder.TextHolder; |
||||
import com.alphawallet.app.ui.widget.holder.WalletHolder; |
||||
|
||||
import org.jetbrains.annotations.NotNull; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
import io.realm.Realm; |
||||
|
||||
public class WalletsAdapter extends RecyclerView.Adapter<BinderViewHolder> implements WalletClickCallback |
||||
{ |
||||
private final OnSetWalletDefaultListener onSetWalletDefaultListener; |
||||
private final ArrayList<Wallet> wallets; |
||||
private Wallet defaultWallet = null; |
||||
private final Context context; |
||||
private final Realm realm; |
||||
private final GenericWalletInteract walletInteract; |
||||
|
||||
public WalletsAdapter(Context ctx, |
||||
OnSetWalletDefaultListener onSetWalletDefaultListener, GenericWalletInteract genericWalletInteract) { |
||||
this.onSetWalletDefaultListener = onSetWalletDefaultListener; |
||||
this.wallets = new ArrayList<>(); |
||||
this.context = ctx; |
||||
this.realm = genericWalletInteract.getWalletRealm(); |
||||
this.walletInteract = genericWalletInteract; |
||||
} |
||||
|
||||
@NotNull |
||||
@Override |
||||
public BinderViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) { |
||||
BinderViewHolder binderViewHolder = null; |
||||
switch (viewType) { |
||||
case WalletHolder.VIEW_TYPE: |
||||
binderViewHolder = new WalletHolder(R.layout.item_wallet_manage, parent, this, realm); |
||||
break; |
||||
case TextHolder.VIEW_TYPE: |
||||
binderViewHolder = new TextHolder(R.layout.item_text_view, parent); |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
return binderViewHolder; |
||||
} |
||||
|
||||
@Override |
||||
public void onBindViewHolder(@NotNull BinderViewHolder holder, int position) { |
||||
switch (getItemViewType(position)) { |
||||
case WalletHolder.VIEW_TYPE: |
||||
Wallet wallet = wallets.get(position); |
||||
Bundle bundle = new Bundle(); |
||||
bundle.putBoolean( |
||||
WalletHolder.IS_DEFAULT_ADDITION, |
||||
defaultWallet != null && defaultWallet.sameAddress(wallet.address)); |
||||
bundle.putBoolean(WalletHolder.IS_LAST_ITEM, getItemCount() == 1); |
||||
holder.bind(wallet, bundle); |
||||
break; |
||||
case TextHolder.VIEW_TYPE: |
||||
wallet = wallets.get(position); |
||||
holder.bind(wallet.address); |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public int getItemCount() { |
||||
return wallets.size(); |
||||
} |
||||
|
||||
@Override |
||||
public int getItemViewType(int position) { |
||||
switch (wallets.get(position).type) |
||||
{ |
||||
default: |
||||
case WATCH: |
||||
case KEYSTORE: |
||||
case KEYSTORE_LEGACY: |
||||
case HDKEY: |
||||
return WalletHolder.VIEW_TYPE; |
||||
case TEXT_MARKER: |
||||
return TextHolder.VIEW_TYPE; |
||||
} |
||||
} |
||||
|
||||
public void setDefaultWallet(Wallet wallet) { |
||||
this.defaultWallet = wallet; |
||||
notifyDataSetChanged(); |
||||
} |
||||
|
||||
public void setWallets(Wallet[] wallets) |
||||
{ |
||||
this.wallets.clear(); |
||||
boolean hasLegacyWallet = false; |
||||
boolean hasWatchWallet = false; |
||||
if (wallets != null) |
||||
{ |
||||
Wallet yourWallets = new Wallet(context.getString(R.string.your_wallets)); |
||||
yourWallets.type = WalletType.TEXT_MARKER; |
||||
this.wallets.add(yourWallets); |
||||
|
||||
//Add HD Wallets
|
||||
for (Wallet w : wallets) |
||||
{ |
||||
switch (w.type) |
||||
{ |
||||
case KEYSTORE_LEGACY: |
||||
case KEYSTORE: |
||||
hasLegacyWallet = true; |
||||
break; |
||||
case HDKEY: |
||||
this.wallets.add(w); |
||||
break; |
||||
case WATCH: |
||||
hasWatchWallet = true; |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (hasLegacyWallet) |
||||
{ |
||||
Wallet legacyText = new Wallet(context.getString(R.string.legacy_wallets)); |
||||
legacyText.type = WalletType.TEXT_MARKER; |
||||
this.wallets.add(legacyText); |
||||
|
||||
for (Wallet w : wallets) |
||||
{ |
||||
if (w.type == WalletType.KEYSTORE || w.type == WalletType.KEYSTORE_LEGACY) |
||||
{ |
||||
this.wallets.add(w); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (hasWatchWallet) |
||||
{ |
||||
Wallet watchText = new Wallet(context.getString(R.string.watch_wallet)); |
||||
watchText.type = WalletType.TEXT_MARKER; |
||||
this.wallets.add(watchText); |
||||
|
||||
for (Wallet w : wallets) |
||||
{ |
||||
if (w.type == WalletType.WATCH) |
||||
{ |
||||
this.wallets.add(w); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
notifyDataSetChanged(); |
||||
} |
||||
|
||||
@Override |
||||
public void onWalletClicked(Wallet wallet) |
||||
{ |
||||
onSetWalletDefaultListener.onSetDefault(wallet); |
||||
} |
||||
|
||||
@Override |
||||
public void ensAvatar(Wallet wallet) |
||||
{ |
||||
walletInteract.updateWalletInfo(wallet, wallet.name, () -> { }); |
||||
} |
||||
|
||||
public void onDestroy() |
||||
{ |
||||
realm.close(); |
||||
} |
||||
|
||||
public interface OnSetWalletDefaultListener { |
||||
void onSetDefault(Wallet wallet); |
||||
} |
||||
} |
@ -0,0 +1,64 @@ |
||||
package com.alphawallet.app.viewmodel; |
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; |
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; |
||||
|
||||
import android.app.UiModeManager; |
||||
import android.content.Context; |
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate; |
||||
|
||||
import com.alphawallet.app.C; |
||||
import com.alphawallet.app.repository.PreferenceRepositoryType; |
||||
|
||||
import javax.inject.Inject; |
||||
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel; |
||||
|
||||
@HiltViewModel |
||||
public class SelectThemeViewModel extends BaseViewModel |
||||
{ |
||||
private final PreferenceRepositoryType preferenceRepository; |
||||
|
||||
@Inject |
||||
public SelectThemeViewModel(PreferenceRepositoryType preferenceRepository) |
||||
{ |
||||
this.preferenceRepository = preferenceRepository; |
||||
} |
||||
|
||||
public int getTheme() |
||||
{ |
||||
return preferenceRepository.getTheme(); |
||||
} |
||||
|
||||
public void setTheme(Context context, int theme) |
||||
{ |
||||
preferenceRepository.setTheme(theme); |
||||
updateTheme(context, theme); |
||||
} |
||||
|
||||
private void updateTheme(Context context, int theme) |
||||
{ |
||||
if (theme == C.THEME_LIGHT) |
||||
{ |
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); |
||||
} |
||||
else if (theme == C.THEME_DARK) |
||||
{ |
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); |
||||
} |
||||
else |
||||
{ |
||||
UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE); |
||||
int mode = uiModeManager.getNightMode(); |
||||
if (mode == UiModeManager.MODE_NIGHT_YES) |
||||
{ |
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); |
||||
} |
||||
else if (mode == UiModeManager.MODE_NIGHT_NO) |
||||
{ |
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,159 +1,163 @@ |
||||
package com.alphawallet.app.widget; |
||||
|
||||
import static com.alphawallet.app.entity.WalletPage.ACTIVITY; |
||||
import static com.alphawallet.app.entity.WalletPage.DAPP_BROWSER; |
||||
import static com.alphawallet.app.entity.WalletPage.SETTINGS; |
||||
import static com.alphawallet.app.entity.WalletPage.WALLET; |
||||
|
||||
import android.content.Context; |
||||
import androidx.annotation.Nullable; |
||||
import android.graphics.Typeface; |
||||
import android.util.AttributeSet; |
||||
import android.view.View; |
||||
import android.widget.ImageView; |
||||
import android.widget.LinearLayout; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.annotation.Nullable; |
||||
import androidx.core.content.res.ResourcesCompat; |
||||
|
||||
import com.alphawallet.app.R; |
||||
import com.alphawallet.app.entity.WalletPage; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
import static com.alphawallet.app.entity.WalletPage.ACTIVITY; |
||||
import static com.alphawallet.app.entity.WalletPage.DAPP_BROWSER; |
||||
import static com.alphawallet.app.entity.WalletPage.SETTINGS; |
||||
import static com.alphawallet.app.entity.WalletPage.WALLET; |
||||
|
||||
public class AWalletBottomNavigationView extends LinearLayout { |
||||
|
||||
private final ImageView dappBrowser; |
||||
private final ImageView wallet; |
||||
private final ImageView settings; |
||||
private final ImageView activity; |
||||
|
||||
public class AWalletBottomNavigationView extends LinearLayout |
||||
{ |
||||
private final TextView dappBrowserLabel; |
||||
private final TextView walletLabel; |
||||
private final TextView settingsLabel; |
||||
private final TextView settingsBadge; |
||||
private final TextView settingsLabel; |
||||
private final RelativeLayout settingsTab; |
||||
private final TextView activityLabel; |
||||
|
||||
private final Typeface regularTypeface; |
||||
private final Typeface semiboldTypeface; |
||||
private final ArrayList<String> settingsBadgeKeys = new ArrayList<>(); |
||||
private OnBottomNavigationItemSelectedListener listener; |
||||
|
||||
private WalletPage selectedItem; |
||||
|
||||
private final ArrayList<String> settingsBadgeKeys = new ArrayList<>(); |
||||
|
||||
public AWalletBottomNavigationView(Context context, @Nullable AttributeSet attrs) { |
||||
public AWalletBottomNavigationView(Context context, @Nullable AttributeSet attrs) |
||||
{ |
||||
super(context, attrs); |
||||
inflate(context, R.layout.layout_bottom_navigation, this); |
||||
dappBrowser = findViewById(R.id.nav_browser); |
||||
wallet = findViewById(R.id.nav_wallet); |
||||
settings = findViewById(R.id.nav_settings); |
||||
activity = findViewById(R.id.nav_activity); |
||||
|
||||
dappBrowserLabel = findViewById(R.id.nav_browser_text); |
||||
walletLabel = findViewById(R.id.nav_wallet_text); |
||||
activityLabel = findViewById(R.id.nav_activity_text); |
||||
dappBrowserLabel = findViewById(R.id.nav_browser_text); |
||||
settingsTab = findViewById(R.id.settings_tab); |
||||
settingsLabel = findViewById(R.id.nav_settings_text); |
||||
settingsBadge = findViewById(R.id.settings_badge); |
||||
activityLabel = findViewById(R.id.nav_activity_text); |
||||
|
||||
//TODO: Refactor with click overlay
|
||||
findViewById(R.id.wallet_tab).setOnClickListener(v -> selectItem(WALLET)); |
||||
findViewById(R.id.browser_tab).setOnClickListener(v -> selectItem(DAPP_BROWSER)); |
||||
findViewById(R.id.settings_tab).setOnClickListener(v -> selectItem(SETTINGS)); |
||||
findViewById(R.id.activity_tab).setOnClickListener(v -> selectItem(ACTIVITY)); |
||||
|
||||
dappBrowser.setOnClickListener(v -> selectItem(DAPP_BROWSER)); |
||||
wallet.setOnClickListener(v -> selectItem(WALLET)); |
||||
settings.setOnClickListener(v -> selectItem(SETTINGS)); |
||||
activity.setOnClickListener(v -> selectItem(ACTIVITY)); |
||||
|
||||
dappBrowserLabel.setOnClickListener(v -> selectItem(DAPP_BROWSER)); |
||||
walletLabel.setOnClickListener(v -> selectItem(WALLET)); |
||||
settingsLabel.setOnClickListener(v -> selectItem(SETTINGS)); |
||||
activityLabel.setOnClickListener(v -> selectItem(ACTIVITY)); |
||||
dappBrowserLabel.setOnClickListener(v -> selectItem(DAPP_BROWSER)); |
||||
settingsTab.setOnClickListener(v -> selectItem(SETTINGS)); |
||||
|
||||
regularTypeface = ResourcesCompat.getFont(getContext(), R.font.font_regular); |
||||
semiboldTypeface = ResourcesCompat.getFont(getContext(), R.font.font_semibold); |
||||
|
||||
// set wallet fragment selected on start
|
||||
setSelectedItem(WALLET); |
||||
} |
||||
|
||||
public void setListener(OnBottomNavigationItemSelectedListener listener) { |
||||
public void setListener(OnBottomNavigationItemSelectedListener listener) |
||||
{ |
||||
this.listener = listener; |
||||
} |
||||
|
||||
private void selectItem(WalletPage index) { |
||||
private void selectItem(WalletPage index) |
||||
{ |
||||
listener.onBottomNavigationItemSelected(index); |
||||
} |
||||
|
||||
public void setSelectedItem(WalletPage index) { |
||||
public WalletPage getSelectedItem() |
||||
{ |
||||
return selectedItem; |
||||
} |
||||
|
||||
public void setSelectedItem(WalletPage index) |
||||
{ |
||||
deselectAll(); |
||||
selectedItem = index; |
||||
switch (index) { |
||||
switch (index) |
||||
{ |
||||
case DAPP_BROWSER: |
||||
dappBrowser.setImageResource(R.drawable.ic_tab_browser_active); |
||||
dappBrowserLabel.setTextColor(getResources().getColor(R.color.colorHighlight, getContext().getTheme())); |
||||
dappBrowserLabel.setSelected(true); |
||||
dappBrowserLabel.setTypeface(semiboldTypeface); |
||||
break; |
||||
case WALLET: |
||||
wallet.setImageResource(R.drawable.ic_tab_wallet_active); |
||||
walletLabel.setTextColor(getResources().getColor(R.color.colorHighlight, getContext().getTheme())); |
||||
walletLabel.setSelected(true); |
||||
walletLabel.setTypeface(semiboldTypeface); |
||||
break; |
||||
case SETTINGS: |
||||
settings.setImageResource(R.drawable.ic_tab_settings_active); |
||||
settingsLabel.setTextColor(getResources().getColor(R.color.colorHighlight, getContext().getTheme())); |
||||
settingsLabel.setSelected(true); |
||||
settingsLabel.setTypeface(semiboldTypeface); |
||||
break; |
||||
case ACTIVITY: |
||||
activity.setImageResource(R.drawable.ic_tab_activity_active); |
||||
activityLabel.setTextColor(getResources().getColor(R.color.colorHighlight, getContext().getTheme())); |
||||
activityLabel.setSelected(true); |
||||
activityLabel.setTypeface(semiboldTypeface); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
public WalletPage getSelectedItem() { |
||||
return selectedItem; |
||||
} |
||||
|
||||
private void deselectAll() { |
||||
dappBrowser.setImageResource(R.drawable.ic_tab_browser); |
||||
wallet.setImageResource(R.drawable.ic_tab_wallet); |
||||
settings.setImageResource(R.drawable.ic_tab_settings); |
||||
activity.setImageResource(R.drawable.ic_tab_activity); |
||||
//reset text colour
|
||||
dappBrowserLabel.setTextColor(getContext().getColor(R.color.dove)); |
||||
walletLabel.setTextColor(getContext().getColor(R.color.dove)); |
||||
settingsLabel.setTextColor(getContext().getColor(R.color.dove)); |
||||
activityLabel.setTextColor(getContext().getColor(R.color.dove)); |
||||
} |
||||
|
||||
public interface OnBottomNavigationItemSelectedListener { |
||||
boolean onBottomNavigationItemSelected(WalletPage index); |
||||
private void deselectAll() |
||||
{ |
||||
dappBrowserLabel.setSelected(false); |
||||
dappBrowserLabel.setTypeface(regularTypeface); |
||||
walletLabel.setSelected(false); |
||||
walletLabel.setTypeface(regularTypeface); |
||||
settingsLabel.setSelected(false); |
||||
settingsLabel.setTypeface(regularTypeface); |
||||
activityLabel.setSelected(false); |
||||
activityLabel.setTypeface(regularTypeface); |
||||
} |
||||
|
||||
public void setSettingsBadgeCount(int count) { |
||||
if (count > 0) { |
||||
public void setSettingsBadgeCount(int count) |
||||
{ |
||||
if (count > 0) |
||||
{ |
||||
settingsBadge.setVisibility(View.VISIBLE); |
||||
} else { |
||||
} |
||||
else |
||||
{ |
||||
settingsBadge.setVisibility(View.GONE); |
||||
} |
||||
settingsBadge.setText(String.valueOf(count)); |
||||
} |
||||
|
||||
public void addSettingsBadgeKey(String key) { |
||||
if (!settingsBadgeKeys.contains(key)) { |
||||
public void addSettingsBadgeKey(String key) |
||||
{ |
||||
if (!settingsBadgeKeys.contains(key)) |
||||
{ |
||||
settingsBadgeKeys.add(key); |
||||
} |
||||
showOrHideSettingsBadge(); |
||||
} |
||||
|
||||
public void removeSettingsBadgeKey(String key) { |
||||
public void removeSettingsBadgeKey(String key) |
||||
{ |
||||
settingsBadgeKeys.remove(key); |
||||
showOrHideSettingsBadge(); |
||||
} |
||||
|
||||
private void showOrHideSettingsBadge() { |
||||
if (settingsBadgeKeys.size() > 0) { |
||||
private void showOrHideSettingsBadge() |
||||
{ |
||||
if (settingsBadgeKeys.size() > 0) |
||||
{ |
||||
settingsBadge.setVisibility(View.VISIBLE); |
||||
} else { |
||||
} |
||||
else |
||||
{ |
||||
settingsBadge.setVisibility(View.GONE); |
||||
} |
||||
settingsBadge.setText(String.valueOf(settingsBadgeKeys.size())); |
||||
} |
||||
|
||||
public void hideBrowserTab() { |
||||
LinearLayout browserTab = findViewById(R.id.browser_tab); |
||||
if (browserTab != null) browserTab.setVisibility(View.GONE); |
||||
public void hideBrowserTab() |
||||
{ |
||||
if (dappBrowserLabel != null) dappBrowserLabel.setVisibility(View.GONE); |
||||
} |
||||
|
||||
public interface OnBottomNavigationItemSelectedListener |
||||
{ |
||||
boolean onBottomNavigationItemSelected(WalletPage index); |
||||
} |
||||
} |
||||
|
@ -1,81 +0,0 @@ |
||||
package com.alphawallet.app.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.content.SharedPreferences; |
||||
import androidx.annotation.LayoutRes; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.preference.PreferenceManager; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.widget.FrameLayout; |
||||
|
||||
import com.alphawallet.app.ui.widget.OnDepositClickListener; |
||||
|
||||
import com.alphawallet.app.R; |
||||
import com.alphawallet.app.entity.Wallet; |
||||
|
||||
public class DepositView extends FrameLayout implements View.OnClickListener { |
||||
|
||||
private static final String coinbaseUrl = "https://buy.coinbase.com/"; |
||||
private static final String localethereum = "https://localethereum.com/"; |
||||
private static final String changelly = "https://payments.changelly.com/?crypto=ETH&amount=0"; |
||||
private final Context context; |
||||
|
||||
private OnDepositClickListener onDepositClickListener; |
||||
@NonNull |
||||
private Wallet wallet; |
||||
|
||||
public DepositView(Context context, @NonNull Wallet wallet) { |
||||
this(context, R.layout.layout_dialog_deposit, wallet); |
||||
} |
||||
|
||||
public DepositView(Context context, @LayoutRes int layoutId, @NonNull Wallet wallet) { |
||||
super(context); |
||||
this.context = context; |
||||
init(layoutId, wallet); |
||||
} |
||||
|
||||
private void init(@LayoutRes int layoutId, @NonNull Wallet wallet) { |
||||
this.wallet = wallet; |
||||
LayoutInflater.from(getContext()).inflate(layoutId, this, true); |
||||
findViewById(R.id.action_coinbase).setOnClickListener(this); |
||||
findViewById(R.id.action_localeth).setOnClickListener(this); |
||||
findViewById(R.id.action_changelly).setOnClickListener(this); |
||||
} |
||||
|
||||
/** |
||||
* After user selects where they want to buy, open Dapp browser at the site |
||||
* @param v |
||||
*/ |
||||
@Override |
||||
public void onClick(View v) { |
||||
String url; |
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); |
||||
String userCurrency = pref.getString("currency_locale", "USD"); |
||||
|
||||
final int action_localeth = R.id.action_localeth; |
||||
final int action_changelly = R.id.action_changelly; |
||||
final int action_coinbase = R.id.action_coinbase; |
||||
|
||||
switch (v.getId()) { |
||||
case action_localeth: { |
||||
url = localethereum; |
||||
} break; |
||||
case action_changelly: { |
||||
url = changelly + "&fiat=" + userCurrency; |
||||
} break; |
||||
default: |
||||
case action_coinbase: { |
||||
url = coinbaseUrl; |
||||
} break; |
||||
} |
||||
if (onDepositClickListener != null) { |
||||
onDepositClickListener.onDepositClick(v, url); |
||||
} |
||||
} |
||||
|
||||
public void setOnDepositClickListener(OnDepositClickListener onDepositClickListener) { |
||||
this.onDepositClickListener = onDepositClickListener; |
||||
} |
||||
} |
@ -1,67 +0,0 @@ |
||||
package com.alphawallet.app.widget; |
||||
|
||||
|
||||
import android.app.Activity; |
||||
import android.app.Dialog; |
||||
import android.graphics.Color; |
||||
import android.graphics.drawable.ColorDrawable; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ArrayAdapter; |
||||
import android.widget.Button; |
||||
import android.widget.Spinner; |
||||
|
||||
import com.alphawallet.app.R; |
||||
|
||||
public class FilterDialog extends Dialog { |
||||
private final Spinner spinnerDate; |
||||
private final Spinner spinnerPrice; |
||||
private final Spinner spinnerTimeframe; |
||||
private final Spinner spinnerDistance; |
||||
private final Button btnApply; |
||||
|
||||
public FilterDialog(Activity activity) { |
||||
super(activity); |
||||
setupDialog(); |
||||
|
||||
spinnerDate = findViewById(R.id.spinner_date); |
||||
spinnerDate.setAdapter(createAdapter(activity, R.array.filter_date)); |
||||
|
||||
spinnerPrice = findViewById(R.id.spinner_price); |
||||
spinnerPrice.setAdapter(createAdapter(activity, R.array.filter_price)); |
||||
|
||||
spinnerDistance = findViewById(R.id.spinner_distance); |
||||
spinnerDistance.setAdapter(createAdapter(activity, R.array.filter_distance)); |
||||
|
||||
spinnerTimeframe = findViewById(R.id.spinner_timeframe); |
||||
spinnerTimeframe.setAdapter(createAdapter(activity, R.array.filter_timeframe)); |
||||
|
||||
btnApply = findViewById(R.id.btn_filter); |
||||
|
||||
btnApply.setOnClickListener(v -> { |
||||
filter(); |
||||
dismiss(); |
||||
}); |
||||
} |
||||
|
||||
private void setupDialog() { |
||||
setContentView(R.layout.dialog_filter); |
||||
setCanceledOnTouchOutside(true); |
||||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
setCanceledOnTouchOutside(true); |
||||
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
||||
} |
||||
|
||||
private void filter() { |
||||
//TODO: Filter action
|
||||
// int dateFilterId = (int) spinnerDate.getSelectedItemId();
|
||||
// int priceFilterId = (int) spinnerPrice.getSelectedItemId();
|
||||
// int distanceFilterId = (int) spinnerDistance.getSelectedItemId();
|
||||
// int timeframeFilterId = (int) spinnerTimeframe.getSelectedItemId();
|
||||
} |
||||
|
||||
private ArrayAdapter<CharSequence> createAdapter(Activity activity, int resId) { |
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(activity, resId, R.layout.item_spinner); |
||||
adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); |
||||
return adapter; |
||||
} |
||||
} |
@ -1,144 +0,0 @@ |
||||
package com.alphawallet.app.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.content.res.ColorStateList; |
||||
import android.content.res.TypedArray; |
||||
import com.google.android.material.textfield.TextInputLayout; |
||||
import androidx.core.view.ViewCompat; |
||||
import androidx.core.view.ViewPropertyAnimatorListenerAdapter; |
||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator; |
||||
import android.text.TextUtils; |
||||
import android.util.AttributeSet; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.view.animation.Interpolator; |
||||
import android.widget.EditText; |
||||
import android.widget.TextView; |
||||
|
||||
import com.alphawallet.app.R; |
||||
|
||||
/** |
||||
* TextInputLayout temporary workaround for helper text showing |
||||
* https://gist.github.com/drstranges/1a86965f582f610244d6
|
||||
*/ |
||||
public class HelperTextInputLayout extends TextInputLayout { |
||||
|
||||
static final Interpolator FAST_OUT_SLOW_IN_INTERPOLATOR = new FastOutSlowInInterpolator(); |
||||
|
||||
private CharSequence mHelperText; |
||||
private ColorStateList mHelperTextColor; |
||||
private boolean mHelperTextEnabled = false; |
||||
private boolean mErrorEnabled = false; |
||||
private TextView mHelperView; |
||||
private int mHelperTextAppearance = R.style.HelperTextAppearance; |
||||
|
||||
public HelperTextInputLayout(Context _context) { |
||||
super(_context); |
||||
} |
||||
|
||||
public HelperTextInputLayout(Context _context, AttributeSet _attrs) { |
||||
super(_context, _attrs); |
||||
|
||||
final TypedArray a = getContext().obtainStyledAttributes( |
||||
_attrs, |
||||
R.styleable.HelperTextInputLayout,0,0); |
||||
try { |
||||
mHelperTextColor = a.getColorStateList(R.styleable.HelperTextInputLayout_helperTextColor); |
||||
mHelperText = a.getText(R.styleable.HelperTextInputLayout_helperText); |
||||
} finally { |
||||
a.recycle(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void addView(View child, int index, ViewGroup.LayoutParams params) { |
||||
super.addView(child, index, params); |
||||
if (child instanceof EditText) { |
||||
if (!TextUtils.isEmpty(mHelperText)) { |
||||
setHelperText(mHelperText); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public int getHelperTextAppearance() { |
||||
return mHelperTextAppearance; |
||||
} |
||||
|
||||
public void setHelperTextAppearance(int _helperTextAppearanceResId) { |
||||
mHelperTextAppearance = _helperTextAppearanceResId; |
||||
} |
||||
|
||||
public void setHelperTextColor(ColorStateList _helperTextColor) { |
||||
mHelperTextColor = _helperTextColor; |
||||
} |
||||
|
||||
public void setHelperTextEnabled(boolean _enabled) { |
||||
if (mHelperTextEnabled == _enabled) return; |
||||
if (_enabled && mErrorEnabled) { |
||||
setErrorEnabled(false); |
||||
} |
||||
if (this.mHelperTextEnabled != _enabled) { |
||||
if (_enabled) { |
||||
this.mHelperView = new TextView(this.getContext()); |
||||
this.mHelperView.setTextAppearance(this.getContext(), this.mHelperTextAppearance); |
||||
if (mHelperTextColor != null){ |
||||
this.mHelperView.setTextColor(mHelperTextColor); |
||||
} |
||||
this.mHelperView.setVisibility(INVISIBLE); |
||||
this.addView(this.mHelperView); |
||||
} else { |
||||
this.removeView(this.mHelperView); |
||||
this.mHelperView = null; |
||||
} |
||||
|
||||
this.mHelperTextEnabled = _enabled; |
||||
} |
||||
} |
||||
|
||||
public void setHelperText(CharSequence _helperText) { |
||||
mHelperText = _helperText; |
||||
if (!this.mHelperTextEnabled) { |
||||
if (TextUtils.isEmpty(mHelperText)) { |
||||
return; |
||||
} |
||||
this.setHelperTextEnabled(true); |
||||
} |
||||
|
||||
if (!TextUtils.isEmpty(mHelperText)) { |
||||
this.mHelperView.setText(mHelperText); |
||||
this.mHelperView.setVisibility(VISIBLE); |
||||
ViewCompat.setAlpha(this.mHelperView, 0.0F); |
||||
ViewCompat.animate(this.mHelperView) |
||||
.alpha(1.0F).setDuration(200L) |
||||
.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) |
||||
.setListener(null).start(); |
||||
} else if (this.mHelperView.getVisibility() == VISIBLE) { |
||||
ViewCompat.animate(this.mHelperView) |
||||
.alpha(0.0F).setDuration(200L) |
||||
.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) |
||||
.setListener(new ViewPropertyAnimatorListenerAdapter() { |
||||
public void onAnimationEnd(View view) { |
||||
mHelperView.setText(null); |
||||
mHelperView.setVisibility(INVISIBLE); |
||||
} |
||||
}).start(); |
||||
} |
||||
this.sendAccessibilityEvent(2048); |
||||
} |
||||
|
||||
@Override |
||||
public void setErrorEnabled(boolean _enabled) { |
||||
if (mErrorEnabled == _enabled) return; |
||||
mErrorEnabled = _enabled; |
||||
if (_enabled && mHelperTextEnabled) { |
||||
setHelperTextEnabled(false); |
||||
} |
||||
|
||||
super.setErrorEnabled(_enabled); |
||||
|
||||
if (!(_enabled || TextUtils.isEmpty(mHelperText))) { |
||||
setHelperText(mHelperText); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,92 +0,0 @@ |
||||
package com.alphawallet.app.widget; |
||||
|
||||
|
||||
import android.app.Activity; |
||||
import android.app.Dialog; |
||||
import android.graphics.Color; |
||||
import android.graphics.drawable.ColorDrawable; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ArrayAdapter; |
||||
import android.widget.Button; |
||||
import android.widget.SeekBar; |
||||
import android.widget.Spinner; |
||||
import android.widget.TextView; |
||||
|
||||
import com.alphawallet.app.R; |
||||
|
||||
import java.util.Locale; |
||||
|
||||
public class SearchDialog extends Dialog { |
||||
private final Spinner spinnerMatch; |
||||
private final Spinner spinnerClass; |
||||
private final Spinner spinnerSeats; |
||||
private final Spinner spinnerDate; |
||||
private final SeekBar priceSeekBar; |
||||
private final Button btnApply; |
||||
private final TextView seekBarValue; |
||||
|
||||
public SearchDialog(Activity activity) { |
||||
super(activity); |
||||
setupDialog(); |
||||
|
||||
spinnerMatch = findViewById(R.id.spinner_match); |
||||
spinnerMatch.setAdapter(createAdapter(activity, R.array.filter_match)); |
||||
|
||||
spinnerClass = findViewById(R.id.spinner_class); |
||||
spinnerClass.setAdapter(createAdapter(activity, R.array.filter_class)); |
||||
|
||||
spinnerSeats = findViewById(R.id.spinner_seats); |
||||
spinnerSeats.setAdapter(createAdapter(activity, R.array.filter_seats)); |
||||
|
||||
spinnerDate = findViewById(R.id.spinner_date); |
||||
spinnerDate.setAdapter(createAdapter(activity, R.array.filter_search_date)); |
||||
|
||||
btnApply = findViewById(R.id.btn_filter); |
||||
|
||||
btnApply.setOnClickListener(v -> { |
||||
search(); |
||||
dismiss(); |
||||
}); |
||||
|
||||
seekBarValue = findViewById(R.id.seek_bar_value); |
||||
|
||||
priceSeekBar = findViewById(R.id.seek_bar_price); |
||||
|
||||
priceSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { |
||||
@Override |
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
||||
double value = progress * 100.00; |
||||
String val = String.format(Locale.getDefault(),"$%.2f", value); |
||||
seekBarValue.setText(val); |
||||
} |
||||
|
||||
@Override |
||||
public void onStartTrackingTouch(SeekBar seekBar) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onStopTrackingTouch(SeekBar seekBar) { |
||||
|
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void setupDialog() { |
||||
setContentView(R.layout.dialog_search); |
||||
setCanceledOnTouchOutside(true); |
||||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
setCanceledOnTouchOutside(true); |
||||
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
||||
} |
||||
|
||||
private void search() { |
||||
//TODO: Search action
|
||||
} |
||||
|
||||
private ArrayAdapter<CharSequence> createAdapter(Activity activity, int resId) { |
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(activity, resId, R.layout.item_spinner); |
||||
adapter.setDropDownViewResource(R.layout.item_spinner_dropdown); |
||||
return adapter; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue