forked from mu7amadfawzy/dialogPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## showing progress while loading countries json from assets
- Loading branch information
fawzy
committed
Oct 2, 2019
1 parent
4ce75d7
commit ad2b412
Showing
4 changed files
with
74 additions
and
37 deletions.
There are no files selected for viewing
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
52 changes: 52 additions & 0 deletions
52
dialogPlus/src/main/java/com/dialog/plus/utils/CommonUtil.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,52 @@ | ||
package com.dialog.plus.utils; | ||
|
||
import android.app.ProgressDialog; | ||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.view.View; | ||
import android.view.inputmethod.InputMethodManager; | ||
|
||
import static android.content.Context.INPUT_METHOD_SERVICE; | ||
import static android.view.Gravity.CENTER; | ||
|
||
/** | ||
* Created by Muhammad Noamany | ||
* [email protected] | ||
*/ | ||
public class CommonUtil { | ||
private static CommonUtil commonUtil; | ||
|
||
public static CommonUtil getInstance() { | ||
if (commonUtil == null) | ||
commonUtil = new CommonUtil(); | ||
return commonUtil; | ||
} | ||
|
||
public ProgressDialog getProgressDialog(Context context) { | ||
ProgressDialog progressDialog = new ProgressDialog(context); | ||
if (progressDialog.getWindow() != null) { | ||
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
progressDialog.getWindow().setGravity(CENTER); | ||
} | ||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); | ||
progressDialog.setProgress(0); | ||
// progressDialog.setContentView(R.layout.progress_dialog); | ||
progressDialog.setIndeterminate(true); | ||
progressDialog.setCancelable(false); | ||
progressDialog.setCanceledOnTouchOutside(false); | ||
return progressDialog; | ||
} | ||
|
||
public void showKeyboard(View view) { | ||
InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(INPUT_METHOD_SERVICE); | ||
view.requestFocus(); | ||
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_FORCED); | ||
} | ||
|
||
public void hideKeyboard(View view) { | ||
final InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); | ||
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); | ||
view.clearFocus(); | ||
} | ||
} |
32 changes: 0 additions & 32 deletions
32
dialogPlus/src/main/java/com/dialog/plus/utils/KeyboardUtil.java
This file was deleted.
Oops, something went wrong.